Skip to content

Java Editor: remove some reflective calls and improve logging #8601

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

mbien
Copy link
Member

@mbien mbien commented Jun 18, 2025

VanillaPartialParser:

  • partial reparse verification is now controlled by the log level
    (-J-Dorg.netbeans.modules.java.source.parsing.VanillaPartialReparser.level=FINE)
  • improved logging (e.g formatting for easy comparison)
  • removed some reflective calls

Tiny, JavaCompletionItem:

  • some enums can be now used directly

GeneratorUtilities, ClipboardHandler:

@mbien mbien added this to the NB27 milestone Jun 18, 2025
@mbien mbien requested review from dbalek and lahodaj June 18, 2025 08:51
@mbien mbien added Code cleanup Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) hints labels Jun 18, 2025
Copy link
Contributor

@eirikbakke eirikbakke left a comment

Choose a reason for hiding this comment

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

I'm not super-familiar with this area, but the cleanups all made sense when reading through them line by line and comparing with the PR description.

@mbien
Copy link
Member Author

mbien commented Jun 22, 2025

to give more context: while working on one of the hint performance improvement PRs, I noticed that essentially everything ran twice, so I searched for the cause and saw this after tweaking log levels:

WARNING [org.netbeans.modules.java.source.parsing.VanillaPartialReparser]: Incorrect partial reparse detected, dump filed ...

(I do also have a small reproducer for this but haven't investigated beyond that)

This would only happen with -ea enabled. So I improved the log output a bit and made that verification step log level dependent instead of based on assertions - so that it can be more selectively switched on/off without more side effects.

To make it worth a PR I also added reflection removal from my stash which was in the same file and similar cases in related files which fit the theme.

@mbien mbien force-pushed the java-editor-reduce-reflection branch from 266e0f7 to 5170bb4 Compare June 23, 2025 09:09
@mbien
Copy link
Member Author

mbien commented Jun 23, 2025

rebased, going to merge once green. thanks for review!

VanillaPartialParser:

 - partial reparse verification is now controlled by the log level
 - improved logging
 - removed some reflective calls

Tiny, JavaCompletionItem:

 - some enums can be now used directly

GeneratorUtilities, ClipboardHandler:

 - remove dead string template code
 - minor cleanup
@mbien mbien force-pushed the java-editor-reduce-reflection branch from 5170bb4 to 1083f9a Compare June 23, 2025 09:18
@mbien mbien merged commit 68e420d into apache:master Jun 23, 2025
71 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code cleanup hints 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