Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character.isWhitespace(-1) returns false #3284

Merged
merged 1 commit into from May 15, 2023

Conversation

tanishiking
Copy link
Member

Fix #3154

Previously, Character.isWhitespace(-1) and
Character.isLowerCase(-1) throw
java.lang.ArrayIndexOutOfBoundsException: -1.
However, they should return false as other java std libraries do.

We may want to fix getTypeLT256, but this commit guaranteed that the codepoint is gte 0 on call-site of getTypeLT256 for not introducing the duplicated check of codePoint < 0.

Fix scala-native#3154

Previously, `Character.isWhitespace(-1)` and
`Character.isLowerCase(-1)` throw
`java.lang.ArrayIndexOutOfBoundsException: -1`.
However, they should return `false` as other java std libraries do.

We may want to fix `getTypeLT256`, but this commit guaranteed that
the codepoint is gte 0 on call-site of `getTypeLT256` for
not introducing the duplicated check of `codePoint < 0`.
@ekrich
Copy link
Member

ekrich commented May 15, 2023

This looks good. It might be a good idea to check Scala.js as well. We like to try and uses the same tests on both and either create an issue or PR in Scala.js too.

Copy link
Member

@ekrich ekrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WojciechMazur WojciechMazur merged commit f71420c into scala-native:main May 15, 2023
68 checks passed
WojciechMazur pushed a commit that referenced this pull request May 23, 2023
Fix #3154

Previously, `Character.isWhitespace(-1)` and
`Character.isLowerCase(-1)` throw
`java.lang.ArrayIndexOutOfBoundsException: -1`.
However, they should return `false` as other java std libraries do.

We may want to fix `getTypeLT256`, but this commit guaranteed that
the codepoint is gte 0 on call-site of `getTypeLT256` for
not introducing the duplicated check of `codePoint < 0`.

(cherry picked from commit f71420c)
WojciechMazur pushed a commit that referenced this pull request Jun 5, 2023
Fix #3154

Previously, `Character.isWhitespace(-1)` and
`Character.isLowerCase(-1)` throw
`java.lang.ArrayIndexOutOfBoundsException: -1`.
However, they should return `false` as other java std libraries do.

We may want to fix `getTypeLT256`, but this commit guaranteed that
the codepoint is gte 0 on call-site of `getTypeLT256` for
not introducing the duplicated check of `codePoint < 0`.

(cherry picked from commit f71420c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Character.isWhitespace(-1) throws an exception
3 participants