Skip to content

Commit dfe815d

Browse files
authored
Merge branch 'eclipse-jdt:master' into master
2 parents 10be61a + 247b3db commit dfe815d

3 files changed

Lines changed: 48 additions & 20 deletions

File tree

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ protected void createExternalFile(String relativePath, String contents) {
168168
protected IFile createFile(String path, byte[] content) throws CoreException {
169169
IFile file = super.createFile(path, content);
170170
if(!isIndexDisabledForTest()) {
171+
/*
172+
* Its possible that the RefreshJob picks up the file delta and requests indexing,
173+
* instead of the main thread (in which tests run). Make sure we don't miss that index request in the wait below.
174+
*/
175+
waitForAutoRefresh();
171176
JavaModelManager.getIndexManager().waitForIndex(false, null);
172177
}
173178
return file;

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SignatureTests.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,9 +1600,17 @@ public void testCreateIntersectionTypeSignature2() {
16001600
}
16011601

16021602
public void testDollarPackage() {
1603-
String signature = Signature.getTypeErasure("Ljava.util.$foo$.Optional");
1603+
String signature = new String(Signature.toCharArray(new String("Ljava.util.$foo$.Optional;").toCharArray()));
16041604
assertEquals(
1605-
"Ljava.util.$foo$.Optional",
1605+
"java.util.$foo$.Optional",
1606+
new String(signature.toCharArray())
1607+
);
1608+
}
1609+
1610+
public void testDollarPackageDollarClass() {
1611+
String signature = new String(Signature.toCharArray(new String("Ljava.util.$foo$.$Optional;").toCharArray()));
1612+
assertEquals(
1613+
"java.util.$foo$..Optional",
16061614
new String(signature.toCharArray())
16071615
);
16081616
}

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)