Blocks :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Given this test case: interface A { Iterable m(List<String> ls); } interface B { Iterable<String> m(List l); } interface AB extends A, B { } interface AA extends A { } If I do: MethodHandle mh1 = MethodHandles.lookup().findVirtual(A.class, "m", MethodType.methodType(Iterable.class, List.class)); MethodHandle mh2 = MethodHandles.lookup().findVirtual(B.class, "m", MethodType.methodType(Iterable.class, List.class)); MethodHandle mh3 = MethodHandles.lookup().findVirtual(AB.class, "m", MethodType.methodType(Iterable.class, List.class)); MethodHandle mh4 = MethodHandles.lookup().findVirtual(AA.class, "m", MethodType.methodType(Iterable.class, List.class)); I would expect all the lookups to succeed. However, only lookups for A, B, and AA succeed; lookups for AB fail with java.lang.NoSuchMethodException: no such method: AB.m(List)Iterable It fails the same way when the generics are removed. So it appears to be a problem with an interface multiply inheriting the same method and not overriding it.
|