frank
12/07/2023, 3:33 PMChronicle-Wire
library, and I found this case:
The read operation need a BiConsumer
value, With Java we can send Setter method but in Kotlin throws compiler error.
Some Kotlin expert, can explain to me: Why I can't send the setter method directly and equivalent short-syntax for Kotlin.
Method Signature:
default <T> WireIn text(T t, @NotNull BiConsumer<T, String> ts) {}
Implementation:
// With Java:
wire.read("name").text(this, Data::setName) // Works
// With Kotlin:
wire.read("name").text(this) { obj, name -> obj.name = name } // Works
wire.read("name").text(this, this::setName) // Compile Error: Type mismatch.
wire.read("name").text(this, this::name) // Compile Error: Type mismatch.
Sam
12/07/2023, 3:52 PMData::name::set
frank
12/07/2023, 3:55 PMSam
12/07/2023, 3:56 PM