Community
Participate
Working Groups
Exception in thread "main" java.lang.ClassFormatError: Method get in class I has illegal modifiers: 0x1041 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) is reported when running the generated .class files. Compile the attached test case.
Created attachment 14705 [details] Compile this test case in -source 1.5 -1.5
Created attachment 14706 [details] Second test case. Compile this test case in -source 1.5 -1.5
Still occurs with build I200410260800.
Problem comes from that we add a bridge method onto the interface J, where it is forbidden. I commented out the addition in case the source type is an interface, which made it work slightly better, but we no longer issue the bridge method on first concrete implementation, which we should. The following variation exposes this issue: public class X { public static void main(String argv[]) { X1<Integer> o1 = new X1<Integer>(); System.out.print(((J<Integer>)o1).get()); } } class X1<T> implements I<T> { public X1 get() { System.out.println("SUCCESS"); return this; } } interface I<T> extends J<T> { I get(); } interface J<T> { J get(); }
added test cases: GenericTypeTest#test345-347
Created attachment 15436 [details] Method verifier patch GenericTypeTests are green with this patch
My patch however breaks 3 other tests (e.g. NegativeTest#test252)
*** Bug 78022 has been marked as a duplicate of this bug. ***
See GenericType tests 345-347
Verified in 200412140800