Skip to content

Commit 3f07f0a

Browse files
jjohnstniloveeclipse
authored andcommitted
Tweak new signature logic that checks context of dollar
- modify Signature.appendClassTypeSignature() logic for the last segment to use the old logic as it appears there is other code that is not prepared for the dollar being part of the class name and expects the dollar being converted to dot
1 parent d340425 commit 3f07f0a

1 file changed

Lines changed: 33 additions & 18 deletions

File tree

org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -667,24 +667,39 @@ private static int appendClassTypeSignature(char[] string, int start, boolean fu
667667
}
668668
break;
669669
case C_DOLLAR :
670-
innerTypeStart = buffer.length();
671-
inAnonymousType = false;
672-
if (resolved) {
673-
if (prevC == C_DOT || nextC == C_DOT) {
674-
buffer.append('$');
675-
} else {
676-
// once we hit "$" there are no more package prefixes
677-
removePackageQualifiers = false;
678-
/**
679-
* Convert '$' in resolved type signatures into '.'.
680-
* NOTE: This assumes that the type signature is an inner type
681-
* signature. This is true in most cases, but someone can define a
682-
* non-inner type name containing a '$'.
683-
*/
684-
buffer.append('.');
685-
}
686-
}
687-
break;
670+
if (nextC == C_DOT) {
671+
buffer.append('$');
672+
} else {
673+
boolean foundDotAfterDollar = false;
674+
if (prevC == C_DOT) {
675+
int i = p + 1;
676+
// check to see if we have dollar as part of package or class
677+
while (i < string.length) {
678+
if (string[i++] == C_DOT) {
679+
foundDotAfterDollar = true;
680+
break;
681+
}
682+
}
683+
}
684+
if (foundDotAfterDollar) {
685+
buffer.append('$');
686+
break;
687+
}
688+
innerTypeStart = buffer.length();
689+
inAnonymousType = false;
690+
if (resolved) {
691+
// once we hit "$" there are no more package prefixes
692+
removePackageQualifiers = false;
693+
/**
694+
* Convert '$' in resolved type signatures into '.'.
695+
* NOTE: This assumes that the type signature is an inner type
696+
* signature. This is true in most cases, but someone can define a
697+
* non-inner type name containing a '$'.
698+
*/
699+
buffer.append('.');
700+
}
701+
}
702+
break;
688703
default :
689704
if (innerTypeStart != -1 && !inAnonymousType && Character.isDigit(c)) {
690705
inAnonymousType = true;

0 commit comments

Comments
 (0)