Skip to content

Conversation

@mbien
Copy link
Member

@mbien mbien commented Jan 29, 2026

uses javac's Element.getKind().isClass() as filter which matches all class kinds.

minor code improvements and indentation fixes

note: the hint is disabled by default

fixes #9166

@mbien mbien added this to the NB29 milestone Jan 29, 2026
@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 Jan 29, 2026
@lahodaj
Copy link
Contributor

lahodaj commented Jan 30, 2026

Hmm, I wonder if the klass.getKind() != ElementKind.CLASS / !klass.getKind().isClass() should even be there. I don't see a reason why the hint should not be working inside e.g. default interface methods? In other words, I am unclear why this restriction was there originally. The hint predates default interface methods, I think, but even before that, interfaces were allowed to have static final fields with initializers?

@mbien
Copy link
Member Author

mbien commented Jan 30, 2026

Hmm, I wonder if the klass.getKind() != ElementKind.CLASS / !klass.getKind().isClass() should even be there. I don't see a reason why the hint should not be working inside e.g. default interface methods?

good point. isClass() || isInterface() sounds like the safe option for now, in case more types show up in future like module files or something like that?

will update it

uses javac's Element.getKind().isDeclaredType() as filter which matches
all class kinds (interfaces, records etc).

minor code improvements and indentation fixes
@mbien mbien force-pushed the static-import-hint-for-records_delivery branch from 909b779 to 4521e36 Compare January 30, 2026 17:36
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.

3 participants