Skip to content
Closed
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
10 changes: 3 additions & 7 deletions vm/JavaAPI/src/java/lang/StringBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,11 @@ public java.lang.StringBuilder reverse(){
for (int i = 0, mid = count / 2; i < mid; i++, --end) {
char frontLow = value[i + 1];
char endHigh = value[end - 1];
boolean surAtFront = allowFrontSur && frontLow >= 0xdc00
&& frontLow <= 0xdfff && frontHigh >= 0xd800
&& frontHigh <= 0xdbff;
boolean surAtFront = allowFrontSur && Character.isSurrogatePair(frontHigh, frontLow);
if (surAtFront && (count < 3)) {
return this;
}
boolean surAtEnd = allowEndSur && endHigh >= 0xd800
&& endHigh <= 0xdbff && endLow >= 0xdc00
&& endLow <= 0xdfff;
boolean surAtEnd = allowEndSur && Character.isSurrogatePair(endHigh, endLow);
allowFrontSur = allowEndSur = true;
if (surAtFront == surAtEnd) {
if (surAtFront) {
Expand Down Expand Up @@ -524,7 +520,7 @@ public java.lang.StringBuilder reverse(){
}*/
return this;
}

/**
* The character at the specified index of this string builder is set to ch. The string builder is altered to represent a new character sequence that is identical to the old character sequence, except that it contains the character ch at position index.
* The offset argument must be greater than or equal to 0, and less than the length of this string builder.
Expand Down