mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
[Java] Fix key lookup returning null clashing with default value (#7236)
A field with key attribute must always be written on the message so it can be looked up by key. There is a edge case where inserting a key field with same value as default would prevent it to be written on the message and later cannot be found when searched by key.
This commit is contained in:
@@ -26,7 +26,7 @@ public final class Referrable extends Table {
|
||||
}
|
||||
|
||||
public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(id); builder.slot(0); }
|
||||
public static int endReferrable(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
|
||||
Reference in New Issue
Block a user