Bug 171383

Summary: [model] IType#getElementName() returns empty string for non-anonymous binary type with $ in name
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: frederic_fusier
Version: 3.3   
Target Milestone: 3.3 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2007-01-23 09:23:28 EST
I20070116-1510

IType#getElementName() returns an empty string for a non-anonymous binary type with a $ in its name:

package p;
public class R$1 {
	public static void main(String[] args) {
		System.out.println("I like $");
	}
}

If you put the p/R$1.class file into a class file folder, IType#getElementName() returns "". Expected: "R$1".

This can lead to strange entries in the Open Type dialog:
- The example shows up as " - p" for pattern "r".
- The IBM J9 1.4.2 VM's system libraries contain such types, e.g. javax.net.ssl.SSLSocketFactory$1, which caused bug 171359.
Comment 1 Frederic Fusier CLA 2007-06-19 09:11:23 EDT
Reproduced with 3.3 RC4.

When java file exists, the model behaves correctly and you can see the R$1 type in the Open Type dialog when typing "r" pattern. This problem only happens when only the class file exists, then there's no way to know whether this is a top-level type or an anonymous without opening the file. As this cannot be done for obvious performance reasons, not sure if there's something to do here...
Comment 2 Jerome Lanneluc CLA 2007-06-19 10:43:07 EDT
Known limitation of the model.