Skip to content

Commit def51b8

Browse files
authored
Remove obsolete ICU references from surrogate-handling comments (#2977)
The XXX comments referenced com.ibm.icu.lang.UCharacter and java.lang.Character behavior on Java 1.4. ICU is no longer a dependency, and the surrogate branches contained no actual logic, so fold the surrogate check into the outer condition and drop the stale comments.
1 parent 93293a9 commit def51b8

2 files changed

Lines changed: 6 additions & 39 deletions

File tree

org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/wizards/NewTestCaseWizardPageOne.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,19 +1107,8 @@ else if (character == '<')
11071107
buffer.replace(index, index + 1, OF_TAG);
11081108
else if (character == '?')
11091109
buffer.replace(index, index + 1, QUESTION_MARK_TAG);
1110-
else if (!Character.isJavaIdentifierPart(character)) {
1111-
// Check for surrogates
1112-
if (!Character.isSurrogate(character)) {
1113-
/*
1114-
* XXX: Here we should create the code point and test whether
1115-
* it is a Java identifier part. Currently this is not possible
1116-
* because java.lang.Character in 1.4 does not support surrogates
1117-
* and because com.ibm.icu.lang.UCharacter.isJavaIdentifierPart(int)
1118-
* is not correctly implemented.
1119-
*/
1120-
buffer.deleteCharAt(index);
1121-
}
1122-
1110+
else if (!Character.isJavaIdentifierPart(character) && !Character.isSurrogate(character)) {
1111+
buffer.deleteCharAt(index);
11231112
}
11241113
}
11251114
}

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaWordFinder.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,8 @@ public static IRegion findWord(IDocument document, int offset) {
3232

3333
while (pos >= 0) {
3434
c= document.getChar(pos);
35-
if (!Character.isJavaIdentifierPart(c)) {
36-
// Check for surrogates
37-
if (Character.isSurrogate(c)) {
38-
/*
39-
* XXX: Here we should create the code point and test whether
40-
* it is a Java identifier part. Currently this is not possible
41-
* because java.lang.Character in 1.4 does not support surrogates
42-
* and because com.ibm.icu.lang.UCharacter.isJavaIdentifierPart(int)
43-
* is not correctly implemented.
44-
*/
45-
} else {
46-
break;
47-
}
35+
if (!Character.isJavaIdentifierPart(c) && !Character.isSurrogate(c)) {
36+
break;
4837
}
4938
--pos;
5039
}
@@ -55,19 +44,8 @@ public static IRegion findWord(IDocument document, int offset) {
5544

5645
while (pos < length) {
5746
c= document.getChar(pos);
58-
if (!Character.isJavaIdentifierPart(c)) {
59-
if (Character.isSurrogate(c)) {
60-
/*
61-
* XXX: Here we should create the code point and test whether
62-
* it is a Java identifier part. Currently this is not possible
63-
* because java.lang.Character in 1.4 does not support surrogates
64-
* and because com.ibm.icu.lang.UCharacter.isJavaIdentifierPart(int)
65-
* is not correctly implemented.
66-
*/
67-
} else {
68-
break;
69-
}
70-
47+
if (!Character.isJavaIdentifierPart(c) && !Character.isSurrogate(c)) {
48+
break;
7149
}
7250
++pos;
7351
}

0 commit comments

Comments
 (0)