Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1600,9 +1600,17 @@ public void testCreateIntersectionTypeSignature2() {
}

public void testDollarPackage() {
String signature = Signature.getTypeErasure("Ljava.util.$foo$.Optional");
String signature = new String(Signature.toCharArray(new String("Ljava.util.$foo$.Optional;").toCharArray()));
assertEquals(
"Ljava.util.$foo$.Optional",
"java.util.$foo$.Optional",
new String(signature.toCharArray())
);
}

public void testDollarPackageDollarClass() {
String signature = new String(Signature.toCharArray(new String("Ljava.util.$foo$.$Optional;").toCharArray()));
assertEquals(
"java.util.$foo$..Optional",
new String(signature.toCharArray())
);
}
Expand Down
51 changes: 33 additions & 18 deletions org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
Original file line number Diff line number Diff line change
Expand Up @@ -667,24 +667,39 @@ private static int appendClassTypeSignature(char[] string, int start, boolean fu
}
break;
case C_DOLLAR :
innerTypeStart = buffer.length();
inAnonymousType = false;
if (resolved) {
if (prevC == C_DOT || nextC == C_DOT) {
buffer.append('$');
} else {
// once we hit "$" there are no more package prefixes
removePackageQualifiers = false;
/**
* Convert '$' in resolved type signatures into '.'.
* NOTE: This assumes that the type signature is an inner type
* signature. This is true in most cases, but someone can define a
* non-inner type name containing a '$'.
*/
buffer.append('.');
}
}
break;
if (nextC == C_DOT) {
buffer.append('$');
} else {
boolean foundDotAfterDollar = false;
if (prevC == C_DOT) {
int i = p + 1;
// check to see if we have dollar as part of package or class
while (i < string.length) {
if (string[i++] == C_DOT) {
foundDotAfterDollar = true;
break;
Comment thread
iloveeclipse marked this conversation as resolved.
}
}
}
if (foundDotAfterDollar) {
buffer.append('$');
break;
}
innerTypeStart = buffer.length();
inAnonymousType = false;
if (resolved) {
// once we hit "$" there are no more package prefixes
removePackageQualifiers = false;
/**
* Convert '$' in resolved type signatures into '.'.
* NOTE: This assumes that the type signature is an inner type
* signature. This is true in most cases, but someone can define a
* non-inner type name containing a '$'.
*/
buffer.append('.');
}
}
Comment thread
iloveeclipse marked this conversation as resolved.
break;
default :
if (innerTypeStart != -1 && !inAnonymousType && Character.isDigit(c)) {
inAnonymousType = true;
Expand Down
Loading