Bug 114266

Summary: name of anonymous inner class in inner class
Product: [Eclipse Project] JDT Reporter: Nick Collier <nick.collier>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.1.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Nick Collier CLA 2005-10-28 18:32:23 EDT
The eclipse compiler compiles an anonymous inner of an inner class as if the
anonymous inner class was part of the enclosing outer class. For example,

public class Foo {
	
	class Bar {
		public ActionListener doSomething() {
			return new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					System.out.println("foo");
				}
				
			};
		}
	}
	
	public void foo() {}

}

compiles as 3 classes: Foo.class, Foo$Bar.class and Foo$1.class where
Foo$1.class is the anonymous inner class. By contrast javac compiles Foo.class,
Foo$Bar.class, and Foo$Bar$1.class which is, I think, the correct behavior.

This difference in the class name causes problem with XML serialization tools
such as XStream because the eclipse and javac name the class differently.
Comment 1 Olivier Thomann CLA 2005-10-28 18:37:46 EDT
What compliance are you using?
It looks like your are using javac 1.5.
If you use the latest version and you set your compliance to 1.5 it should
behave the same.
Closing as dup of bug 108856.

*** This bug has been marked as a duplicate of 108856 ***
Comment 2 Olivier Thomann CLA 2006-01-10 09:47:38 EST
Verified in M20060109-0800 for 3.1.2