Skip to content

Update SuppressWarnings hint with full set of diag keys - #9578

Open
mbien wants to merge 1 commit into
apache:masterfrom
mbien:suppress-javac-warning-hint
Open

Update SuppressWarnings hint with full set of diag keys#9578
mbien wants to merge 1 commit into
apache:masterfrom
mbien:suppress-javac-warning-hint

Conversation

@mbien

@mbien mbien commented Aug 27, 2026

Copy link
Copy Markdown
Member

unfortunately there doesn't seem to be a good way to get the diagnostics keys from javac directly and map them to category keys.

junit test will check for updates and suggest a code snippet on failure

fixes #9444
fixes #9474

@mbien mbien added this to the NB32 milestone Aug 27, 2026
@mbien
mbien requested a review from lahodaj August 27, 2026 06:30
@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) hints ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Aug 27, 2026
@mbien
mbien force-pushed the suppress-javac-warning-hint branch from d0326b5 to 847555a Compare August 27, 2026 07:03

@lahodaj lahodaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this. We could, theoretically, either read the values at runtime, or using an AP at compile time, but given the overall context, it feels unnecessarily heavy/complicated. This is relatively straightforward code, that will fail once when we upgrade javac, we fix the code (by copying what the test prints), and all will be fine.

In theory, we could read the data from LintWarnings, rather than parsing the properties, but I think it is easier to parse the properties.

Thanks for fixing this!

@mbien

mbien commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

yeah, originally I hoped to do that at runtime but there was no clean way to grab the mapping. I think its better to have the ugly bits in the junit test - the idea is that this should be easy to maintain on nb-javac updates. Since I am going to forget within 6 month where the keys are from but the test remembers ;)

Going to fix a typo and add a few comments + merge. Thanks for review!

unfortunately there doesn't seem to be a good way to get the
diagnostics keys from javac directly and map them to category keys.

junit test will check for updates and suggest a code snippet on failure
@mbien
mbien force-pushed the suppress-javac-warning-hint branch from 847555a to a3cca5d Compare August 27, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) 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.

Several javac warning hints are missing the action to suppress the warning Java hint Raw Types does not provide action to suppress the warning

2 participants