mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +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:
@@ -37,7 +37,7 @@ public final class Stat extends Table {
|
||||
public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); }
|
||||
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
|
||||
public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
|
||||
public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short) count, (short) 0); }
|
||||
public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort((short) count); builder.slot(2); }
|
||||
public static int endStat(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
|
||||
Reference in New Issue
Block a user