Branch: refs/heads/main
  Home:   https://github.com/pmd/pmd
  Commit: 8c0a9355ea8966fa69a20c35c1299b03fc9ab29a
      https://github.com/pmd/pmd/commit/8c0a9355ea8966fa69a20c35c1299b03fc9ab29a
  Author: hexonal <[email protected]>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M docs/pages/release_notes.md
    M 
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportRule.java
    M 
pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryImport.xml

  Log Message:
  -----------
  [java] Fix UnnecessaryImport false positive for array-typed Javadoc {@link} 
parameters (#6884)

fix(java): UnnecessaryImport false positive for array-typed javadoc params

When a Javadoc {@link}/{@see} reference includes a method parameter with
an array type, e.g. {@link Foo#bar(Type[])}, the regex-captured parameter
string kept the trailing "[]" and was compared as-is against the imported
simple name. "Type[]" never equals "Type", so the import was wrongly
flagged as unused.

Strip a trailing "..." (varargs) and any trailing "[]" pairs off each
captured parameter type before matching it against single-name and
on-demand imports.

Fixes #6651

Co-authored-by: Sören Glimm <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/pmd/pmd/settings/notifications


_______________________________________________
Pmd-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmd-commits

Reply via email to