mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 15:37:27 +00:00
[Kotlin] Fix key lookup returning null clashing with default value (#7237)
* [Java] Fix key lookup returning null clashing with default value 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. * [Kotlin] Fix key lookup returning null clashing with default value 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. Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -73,7 +73,10 @@ class Stat : Table() {
|
||||
fun startStat(builder: FlatBufferBuilder) = builder.startTable(3)
|
||||
fun addId(builder: FlatBufferBuilder, id: Int) = builder.addOffset(0, id, 0)
|
||||
fun addVal_(builder: FlatBufferBuilder, val_: Long) = builder.addLong(1, val_, 0L)
|
||||
fun addCount(builder: FlatBufferBuilder, count: UShort) = builder.addShort(2, count.toShort(), 0)
|
||||
fun addCount(builder: FlatBufferBuilder, count: UShort) {
|
||||
builder.addShort(count.toShort())
|
||||
builder.slot(2)
|
||||
}
|
||||
fun endStat(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
|
||||
Reference in New Issue
Block a user