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

ICU-22984 Generate old Java monkeys #3301

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Dec 13, 2024

Copied from the C++ in #3287 and hammered upon until it compiled and passed.

Checklist

  • Required: Issue filed: ICU-22984
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@eggrobin eggrobin marked this pull request as ready for review December 20, 2024 02:59
@eggrobin eggrobin requested a review from markusicu December 20, 2024 02:59
Copy link
Member

@markusicu markusicu left a comment

Choose a reason for hiding this comment

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

CI check failure:

Error:    RBBITestMonkey.TestLineMonkey:1694->RunMonkey:1459 » IllegalArgument Rule $NU × ($AL | $HL) found a break at a position which does not correspond to an index in the original string
Error:    RBBITestMonkey.TestRTLineMonkey:1763->RunMonkey:1459 » IllegalArgument Rule $NU × ($AL | $HL) found a break at a position which does not correspond to an index in the original string

tools/currency/.project Outdated Show resolved Hide resolved
@markusicu
Copy link
Member

changes lgtm but the CI check still fails

@markusicu
Copy link
Member

works in Java 11, 17, 21, but fails in Java 8; some Java regex behavior change? maybe skip these tests on Java 8??

@eggrobin
Copy link
Member Author

Well, I ended up narrowing down the Java 8 inconsistency to something about surrogates, so I changed the code to not produce nor match them before Java 9.

@eggrobin eggrobin requested a review from markusicu January 21, 2025 17:45
@@ -1433,6 +1433,12 @@ void RunMonkey(BreakIterator bi, RBBIMonkeyKind mk, String name, int seed, int
if (c < 0) { // TODO: deal with sets containing strings.
errln("c < 0");
}
// Do not emit surrogates on Java 8, as the behaviour of regular expressions that
// match surrogates differs there.
if (System.getProperty("java.version").startsWith("1.") &&
Copy link
Member

Choose a reason for hiding this comment

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

Please pull the System.getProperty() and version check out of the loop.

// Do not emit surrogates on Java 8, as the behaviour of regular expressions that
// match surrogates differs there.
if (System.getProperty("java.version").startsWith("1.") &&
Character.isSurrogate((char)c)) {
Copy link
Member

Choose a reason for hiding this comment

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

This also triggers for U+1D800, U+2D800, ...

Please check Character.isBmpCodePoint(c) first.

(Don't ask me why isSurrogate() does not take an int code point.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants