Small optimization on "deserialization" and fix on benchmarks again (#7982)

* [Kotlin] Small optimizations and benchmark on deserialization

* [Kotlin] Remove redudant assign() method (use init() instead)

* [Kotlin] Fix benchmark run after change in flatbuffers-java deps

Commit 6e214c3a49 fixes Kotlin build,
but makes the kotlin-benchmark plugin misses the java classes at
runtime, causing NotClassFoundError. The alternative to solve the issue
is to read java's pom.xml to get the latest java version and use it
as dependency. With that we avoid compilation errors on a new version and
keep benchmark plugin happy.
This commit is contained in:
Paulo Pinheiro
2023-05-31 20:02:39 +02:00
committed by GitHub
parent 6e214c3a49
commit 85088a196d
4 changed files with 117 additions and 46 deletions

View File

@@ -81,10 +81,10 @@ public open class Table {
/** Used to hold the vtable size. */
public var vtableSize: Int = 0
protected inline fun <reified T> Int.invalid(default: T, valid: (Int) -> T) : T =
protected inline fun <reified T> Int.invalid(default: T, crossinline valid: (Int) -> T) : T =
if (this != 0) valid(this) else default
protected inline fun <reified T> lookupField(i: Int, default: T, found: (Int) -> T) : T =
protected inline fun <reified T> lookupField(i: Int, default: T, crossinline found: (Int) -> T) : T =
offset(i).invalid(default) { found(it) }
/**