Justin Breitfeller
04/23/2020, 4:12 PMMyJavaClass::hasData
as an IsStateRunningCheck
argument I get the following error. Found KFunction1 and not my interface. Is this an instance of SAM conversion not working properly or is there something I can do to make this possible.
@FunctionalInterface
protected interface IsStateRunningCheck<T> {
boolean isStateRunning(T state);
}
For instance:
fun myFooMethod(stateCheck: IsStateRunnningCheck<Int>) { ... }
fun test() {
myFooMethod(MyJavaClass::hasData) // fails to compile
myFooMyethod( { it.hasData() }) // works fine
}
// I don't think it matters if this is java or not
class MyJavaClass<Int> {
boolean hasData(int x) { return true; }
}
E.Kisaragi
04/23/2020, 5:06 PMJustin Breitfeller
04/23/2020, 6:09 PMJustin Breitfeller
04/23/2020, 6:13 PM