Java 8 interface default
and static
methods can't be called from Python on Android when minSdk < 24
#1204
Labels
default
and static
methods can't be called from Python on Android when minSdk < 24
#1204
For default methods, "desugaring" occurs to transform the bytecode into something which could have been generated by a Java 7 compiler. Based on my experiments, desugaring always occurs unless one of the following is true:
Based on my experiements with dexdump, the desugaring works as follows:
$-CC
class which contains the method implementations.So at runtime, the reflection API will indicate that the methods are abstract and not default. They can still be called via the subclass, but they can't be called via the interface. And the extra abstract methods may prevent the interface from being recognized as functional (which is why
test_call_interface_default
is disabled on Android).The only workaround I can see is to detect the existence of the
$-CC
class, and use it to work out which methods are supposed to be default.The text was updated successfully, but these errors were encountered: