Skip to content

Conversation

mbien
Copy link
Member

@mbien mbien commented Sep 7, 2025

Calling contains on the list should be more efficient compared to copying the list into EnumSet + HashSet first just to call contains on them.

Simpler code which doesn't catch IAEs during regular execution which would show up in JFR logs during auto completion.

@mbien mbien added this to the NB28 milestone Sep 7, 2025
@mbien mbien added Code cleanup Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) labels Sep 7, 2025
@mbien mbien requested review from dbalek and lahodaj September 7, 2025 06:00
@lkishalmi
Copy link
Contributor

Just a question. Were the copy made to avoid some concurrent modification exceptions?

@mbien
Copy link
Member Author

mbien commented Oct 1, 2025

Just a question. Were the copy made to avoid some concurrent modification exceptions?

I don't think so. Before we had for(String context : contexts) which created the two Sets. Now we have contexts.contains().

The for-loop would be able to throw CMEs too if the list is modified while iterating. I am also pretty sure that the context list is immutable. (it lists all the places where a abbreviation like "psvm" can be used, e.g CLASS level)

Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

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

LGTM

list.contains() should be more efficient compared to copying the list
into EnumSet + HashSet first just to call contains on them.

Simpler code which doesn't catch IAEs during regular execution which
would show up in JFR logs during auto completion.
@mbien mbien force-pushed the simplify-java-template-filter branch from 9678571 to 10921f5 Compare October 2, 2025 03:35
@mbien mbien merged commit 2adcfa1 into apache:master Oct 2, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code cleanup Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants