Bug 74594 - [1.5] ClassFormat error when running this example
Summary: [1.5] ClassFormat error when running this example
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 78022 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-22 12:12 EDT by Olivier Thomann CLA
Modified: 2004-12-14 14:52 EST (History)
2 users (show)

See Also:


Attachments
Compile this test case in -source 1.5 -1.5 (399 bytes, text/plain)
2004-09-22 12:13 EDT, Olivier Thomann CLA
no flags Details
Second test case. Compile this test case in -source 1.5 -1.5 (482 bytes, text/plain)
2004-09-22 12:17 EDT, Olivier Thomann CLA
no flags Details
Method verifier patch (9.72 KB, patch)
2004-10-28 07:54 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2004-09-22 12:12:49 EDT
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.
Comment 1 Olivier Thomann CLA 2004-09-22 12:13:06 EDT
Created attachment 14705 [details]
Compile this test case in -source 1.5 -1.5
Comment 2 Olivier Thomann CLA 2004-09-22 12:17:32 EDT
Created attachment 14706 [details]
Second test case. Compile this test case in -source 1.5 -1.5
Comment 3 Frederic Fusier CLA 2004-10-28 04:42:39 EDT
Still occurs with build I200410260800.
Comment 4 Philipe Mulet CLA 2004-10-28 07:04:57 EDT
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();
}
Comment 5 Philipe Mulet CLA 2004-10-28 07:07:16 EDT
added test cases: GenericTypeTest#test345-347
Comment 6 Philipe Mulet CLA 2004-10-28 07:54:33 EDT
Created attachment 15436 [details]
Method verifier patch

GenericTypeTests are green with this patch
Comment 7 Philipe Mulet CLA 2004-10-28 09:23:49 EDT
My patch however breaks 3 other tests (e.g. NegativeTest#test252)
Comment 8 Philipe Mulet CLA 2004-11-09 06:52:24 EST
*** Bug 78022 has been marked as a duplicate of this bug. ***
Comment 9 Kent Johnson CLA 2004-11-16 15:37:25 EST
See GenericType tests 345-347
Comment 10 Olivier Thomann CLA 2004-12-14 14:52:04 EST
Verified in 200412140800