-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix #2304: [java] UnnecessaryImport FP for on-demand imports in JavaDoc #5818
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
Conversation
|
Compared to main: (comment created at 2025-06-20 12:08:46+00:00 for f274956) |
adangel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
For the test cases, I think, we shouldn't allow more than java/javadoc itself allows. Means - if javadoc can't resolve a reference because of a missing import, we shouldn't try to resolve it either.
...va/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryImport.xml
Show resolved
Hide resolved
...va/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryImport.xml
Show resolved
Hide resolved
...va/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryImport.xml
Show resolved
Hide resolved
…cases also supported by JavaDoc
|
Hi @adangel, |
adangel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Describe the PR
This should catch some FPs when referencing Classes/Methods/Fields from (static) on-demand imports in JavaDoc.
One case I explicitly didn't add support for was when referencing a static method in JavaDoc without its class, since IntelliJ also doesn't support such links.
Examples:
This is supported:
But this not: (this is also not supported by javadoc)
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)