Bug 125570 - [1.5][compiler] Named inner inner classes have illegal names
Summary: [1.5][compiler] Named inner inner classes have illegal names
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 16:19 EST by Erling Ellingsen CLA
Modified: 2006-02-15 10:19 EST (History)
0 users

See Also:


Attachments
Same fix as for 108856, just 10 lines further down :-) (719 bytes, patch)
2006-01-27 16:20 EST, Erling Ellingsen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erling Ellingsen CLA 2006-01-27 16:19:18 EST
Bug 108856 covers anonymous class, but the same bug exists for named classes.

Test file:

public class ClassNameTest {
    public static void main(String[] s) {
	new Object(){{
	    System.out.println(this.getClass());
	    System.out.println(this.getClass().getSimpleName());
	    new Object(){{
		System.out.println(this.getClass());
		System.out.println(this.getClass().getSimpleName());
		class X {{
		    System.out.println(this.getClass());
		    System.out.println(this.getClass().getSimpleName());
		}};
		new X();
	    }};
	}};
    }
}

Output when compiled with javac:

class ClassNameTest$1

class ClassNameTest$1$1

class ClassNameTest$1$1$1X
X


Output when compiled with Eclipse:

class common.test.ClassNameTest$1

class common.test.ClassNameTest$1$1

class common.test.ClassNameTest$1X
Exception in thread "main" java.lang.InternalError: Malformed class name
        at java.lang.Class.getSimpleBinaryName(Class.java:1223)
        at java.lang.Class.getSimpleName(Class.java:1108)
        at common.test.ClassNameTest$1X.<init>(ClassNameTest.java:13)
        at common.test.ClassNameTest$1$1.<init>(ClassNameTest.java:15)
        at common.test.ClassNameTest$1.<init>(ClassNameTest.java:8)
        at common.test.ClassNameTest.<clinit>(ClassNameTest.java:5)
Comment 1 Erling Ellingsen CLA 2006-01-27 16:20:43 EST
Created attachment 33738 [details]
Same fix as for 108856, just 10 lines further down :-)
Comment 2 Olivier Thomann CLA 2006-01-27 16:45:16 EST
Thanks. Will be fixed shortly.
Comment 3 Olivier Thomann CLA 2006-01-27 16:57:51 EST
Fixed and released in HEAD.
Added regression test in:
org.eclipse.jdt.core.tests.compiler.regression.Compliance_1_3.test104,
org.eclipse.jdt.core.tests.compiler.regression.Compliance_1_4.test104,
org.eclipse.jdt.core.tests.compiler.regression.Compliance_1_5.test104
Comment 4 Erling Ellingsen CLA 2006-01-27 17:00:51 EST
Wow, that was fast. Thanks!
Comment 5 Philipe Mulet CLA 2006-01-28 07:34:43 EST
Olivier - pls backport to 3.1.x.
Comment 6 Olivier Thomann CLA 2006-01-29 15:48:32 EST
Backported in 3.1.x and contribution list is updated.
Comment 7 David Audel CLA 2006-02-15 10:19:32 EST
Verified for 3.2 M5 using build I20060215-0010