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

Make NetBeans aware of the StringTemplate.STR default field import. #6908

Merged
merged 1 commit into from Jan 5, 2024

Conversation

mbien
Copy link
Member

@mbien mbien commented Jan 3, 2024

  • auto import after paste should not import STR
  • organize imports and fix imports actions should not import STR
  • java.lang imports removal hint should suggest removal of 'import static java.lang.StringTemplate.STR' too
  • handling of StringTemplate.RAW should remain unchanged since it is not a default import

quote from JEP 430:

STR is a public static final field that is automatically imported into every Java source file.

test:
paste this into a JDK 21+ project with preview enabled:

        System.out.println(STR."hello world");
        System.out.println(RAW."hello world");

it should only suggest RAW as import.

The redundant lang import hint should now know about STR too:
image

 - auto import after paste should not import STR
 - organize imports and fix imports should not import STR
 - java.lang imports removal hint should suggest removal of
   'import static java.lang.StringTemplate.STR' too
 - handling of StringTemplate.RAW should remain unchanged since
   it is not a default import
@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 3, 2024
@mbien mbien added this to the NB21 milestone Jan 3, 2024
@mbien mbien requested review from dbalek and lahodaj January 3, 2024 01:21
Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

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

Looks OK.

@mbien
Copy link
Member Author

mbien commented Jan 5, 2024

thanks for the review!

If java happens to add more of those default static imports we should centralize the logic somehow. So that it isn't implemented three times in slightly different ways. Merging.

@mbien mbien merged commit b951c31 into apache:master Jan 5, 2024
36 checks passed
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.

None yet

2 participants