Community
Participate
Working Groups
I20051213-0010 'Navigate > Open External Javadoc' fails for nested binary types, e.g. java.util.Map.Entry (1.4 and 1.5) or java.lang.Thread.State (1.5 only) The constructed URL is e.g.: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map$Entry.html but correct would be: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.Entry.html
To contruct the URL we use type.getTypeQualifiedName('.'). The returned name is 'Map$Entry' but I specified to use '.' as separator. Olivier, you also have this code (in jdt.core), but manually replaced all '$' in '.'. This also look like a bug as types can contain '$' in their names.
I will investigate.
getTypeQualifiedName('.') returns what is specified. One of the examples is wrong. For a binary type, it is spec'd to return the name of the class file without the '.class' extension. Replacing '$' with '.' is wrong, but since there is no way to know the name of the enclosing type through API this is the best that can be done for now. The .class file has information about the enclosing type in the inner class info, but I don't see how to retrieve this through API.
I was wrong. Using getDeclaringType() is good enough.
Fixed and released in HEAD. Existing tests are already testing this case. Navigate> Open External Javadoc still needs to be fixed.
The spec in getTypeQualifiedName was ambiguous. You could have changed it both ways, but I realize that the implementation returns '$', so changing that might break some clients, But then it would many bugs in our code, as we weren't aware of that issue, and I guess nobody expects a '$' here (have to check all our references). I have no idea whats the use case for a qualified name like 'java.util.Map$Entry'. If you would want that you would use getFullyQualifiedName ('$'). Also in the AST you would get 'java.util.Map.Entry' as qualified name. BTW. Also getFullyQualifiedName has the 'bad' example. I added a util again to JavaModelUtil, and will have to change all our references to the jdt.core to use the util again. public static String getTypeQualifiedName(IType type) { try { if (type.isBinary() && !type.isAnonymous()) { IType declaringType= type.getDeclaringType(); if (declaringType != null) { return getTypeQualifiedName(declaringType) + '.' + type.getElementName(); } } } catch (JavaModelException e) { // ignore } return type.getTypeQualifiedName('.'); }
To fix the problem in our code (as described in comment 6) I opened bug 120831.
Verified for 3.2 M4 using build I20051214-0010.