automerge / automerge/automerge-java
Issue with saving long values in a document
- Dominant language
- Java
- Stars
- 46
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
When we try to save a long value into a map entry, it seems like it is saved as a float value. Following code prints "F64" as the type
```
import org.automerge.*;
import java.util.Optional;
public class IntFloatIssue {
public static void main(String args[]) {
Document doc = new Document();
ObjectId annoMapObj;
try (Transaction tx = doc.startTransaction()) {
annoMapObj = tx.set(ObjectId.ROOT, "annotations", ObjectType.MAP);
long value = 10000000000L;
tx.set(annoMapObj, "longval", value);
tx.commit();
}
Optional amValue = doc.get(annoMapObj, "longval");
System.out.println(amValue.get().getClass().getSimpleName());
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Run the supplied Java reproducer first, then trace Document.get and Transaction.set around numeric value handling. Done means storing 10000000000L in the map returns a long or integer value rather than F64, with a regression test covering the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100