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

Implement Java 8 String.split() semantics #10054

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

Conversation

niloc132
Copy link
Member

In Java 8, String.split() changed to not return an initial empty string on a zero-width match. This patch brings GWT's String emulation in compliance with that specification change.

Added additional tests for non-zero-width matches and verifying behavior on all-empty matches. Compile time constant tests also updated to match.

Fixes #8868

@niloc132 niloc132 added this to the 2.13 milestone Dec 10, 2024
@niloc132
Copy link
Member Author

We may want to offer a property to reflect the old behavior since it it has been so long that we haven't had this.

@niloc132
Copy link
Member Author

Passing nightly build https://github.com/niloc132/gwt/actions/runs/12236319531

@vegegoku
Copy link
Contributor

We may want to offer a property to reflect the old behavior since it it has been so long that we haven't had this.

Should we actually keep the old behavior as the default with a property or a flag to switch to the new correct behavior, we keep this for a while but we make sure to generate a warning when old behavior is used, later we remove it at all.. WDYT?

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.

Make string.split implement Java8 semantics
2 participants