Community
Participate
Working Groups
Problem with code similar to: public class MyClass implements MyInterface{ public void myMethod(myEnum value) { System.out.println("value is "+value); } public static void main(String[] args){ new MyClass().myMethod(myEnum.one); } } interface MyInterface<T> { enum myEnum {one,two}; public void myMethod(myEnum value); } Says "The type MyClass must implement the inherited abstract method MyInterface.myMethod (MyInterface.myEnum)" 3.1/RC3
Looks like a compiler problem.
May be related to bug 100546, since enums are implicitly static.
javac accepts this code
*** Bug 101473 has been marked as a duplicate of this bug. ***
Philippe: we are getting thrown off because the 2 methods appear to have different parameters. The method myMethod from MyClass has a ParameterizedType myEnum, but the method myMethod from MyInterface#RAW has myEnum#RAW as its parameter. Should MyClass.myMethod pick up myEnum as a Parameterized type? It looks like it should be a raw type...
We have the same problem with raw member types. class Y implements I { // is not I.M#RAW but is Parameterized M inside I#RAW public void x(M value) {} } interface I<T> { class M {} void x(M value); }
Philippe: Please look at ParamaterizedTypeBinding.memberTypes() It is not overridden in RawTypeBinding. Why should a RawTypeBinding's member types not be raw types also?
Actually, the bug comes from the other side. The reference to non-generic member of raw type should be a ParameterizedTypeBinding with raw enclosing type, and null arguments (denoting these special constructs). Problem comes from Scope.substitute(...) of a generic type.
Added GenericTypeTest#test819-820. Fixed in 3.1.x and 3.2.0 streams.
Verified in I20050920-0010 for 3.2M2
Verified using M20050923-1430 for 3.1.1