Calling Java 8 interface default
and static
methods from Python is not fully tested
#1205
Labels
default
and static
methods from Python is not fully tested
#1205
Apart from the Android issue in #1204, there may also be some non-Android-specific corner cases that we still don't cover:
Both dynamic and static proxies should be able to leave a default method unimplemented, in which case calling the method on the the proxy class should go through to the default.
Default methods can be hidden by:
AbstractSequentialList.listIterator
).In all cases, attempting to call the method should be an error.
An interface (unlike an abstract class) cannot force the implementing class to implement a public Object method. In Java it can force the implementing class to publicly implement a protected Object method, but that'll work differently in Python because we're treating protected as equivalent to public.
It's possible to inherit an interface method implementation from a superclass which doesn't implement that interface. So the MRO should go along the "extends" chain up to but not including Object, then through the interfaces, then Object. This would ensure that if the method exists (even abstractly) in an indirectly-extended class, then default methods (if any) of directly-inherited interfaces will not be called, and an abstract method error will not occur. It might not be possible to do this through the Python MRO rules, but we're currently not using them anyway (see
reflect_member
).If a class inherits multiple default methods with the same signature, the JLS requires it to explicitly implement that method.
We may now need to search in multiple bases for inherited overloads of default and static interface methods: see what the JLS says about this.
The text was updated successfully, but these errors were encountered: