google / google/flatbuffers

Support ulong in Java

Open
#8,610 2 comments 0 reactions 0 assignees View on GitHub
java pr-requested
Dominant language
C++
Stars
26.5k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

I'm working with some game data with weird values, so I made the following enum:

```fbs
enum Condition : ulong {
Empty = 0,
GreaterThanEqual = 0x34F605C97C571896,
LessThanEqual = 0x488B1F9FBC949365,
NotEqual = 0x88C99E99F1FC6C55,
Equal = 0xB763CBE88B6F844F,
None = 0xCBF29CE484222645,
Between = 0xE5E34D77DC75E2EF
}
```

However, trying to compile this in Java:
```java
/path/to/project/generated/TiggerConditionType.java:43: error: integer number too large
public static final long None = 14695981039346656837L;
^
```
The issue seems to stem from the fact that `long` is a signed type in Java, but the generator places it as if it were a ulong, not realizing it should be converting it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.