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

Remove or fix "immutable" APIs on JNode types and internal collections #10009

Open
niloc132 opened this issue Oct 16, 2024 · 0 comments
Open

Comments

@niloc132
Copy link
Member

Ticket created from discussion at #10005:

[I]t seems like the implementations of accept(List) and acceptImmutable(List) in JModVisitor both modify the list, if the list contains more than one item. If the list contains only a single item then acceptImmutable(List) returns a new Collections.singletonList() while accept(List) edits the list in-place.

[T]his 'immutable' code originated with 4c079fb, where it actually appears to have been immutable.. except for Lists.set with a collection of more than one item. This caused a later bug and was partially, but not fully removed in 08dc8cd (see also https://gwt-review.googlesource.com/c/gwt/+/7640/7) with some discussion, but the refactor was apparently not completed?

This ticket is to revisit these decisions, either revert changes in 08dc8cd so that JBlock and friends are still immutable and Lists.add changed to correctly produce immutable lists, or to finish removing these APIs and use something like standard Guava or Java 11+ collections.

Consider approaching this after #10007 has some resolution, so we can measure impacts to memory and CPU usage for some sample builds.

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

No branches or pull requests

1 participant