Skip to content

Commit

Permalink
Update String#length to comply with JEP 254
Browse files Browse the repository at this point in the history
The value returned by java.lang.String#length in the MJI model class for
java.lang.String is incorrect, as the value field of String is
now a byte array instead of a char array.

This updates String#length method to comply with JEP 254.
  • Loading branch information
gayanW committed Jul 28, 2018
1 parent 9f076bc commit f9c86e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/classes/modules/java.base/java/lang/String.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ public String(StringBuilder x) {
String(int offset, int count, char[] value) {
this(value, offset, count);
}

@Override
public int length() {
return value.length;
return value.length >> coder();
}

public boolean isEmpty() {
return value.length == 0;
}
Expand Down

0 comments on commit f9c86e0

Please sign in to comment.