Skip to content

[java] PackageCase: Suppression comment has no effect due to finding at wrong position in case of JavaDoc comment #5452

@sratz

Description

@sratz

Affects PMD Version: 7.9.0

Rule: PackageCase

Description:

The NOPMD comment does not work correctly in PMD 7.9.0 if the line preceding is JavaDoc.

Maybe regression of #4939?

Code Sample demonstrating the issue:

/**
*/
package foo.Bar; //NOPMD upper-case package name ok

public class Baz { }

Steps to reproduce:

PMD 7.8.0: OK, finding correctly suppressed:

$ ./pmd-bin-7.8.0/bin/pmd check --rulesets=category/java/codestyle.xml/PackageCase -d foo --no-progress --no-cache

PMD 7.9.0: NOT OK, finding not correctly suppressed:

$ ./pmd-bin-7.9.0/bin/pmd check --rulesets=category/java/codestyle.xml/PackageCase -d foo --no-progress --no-cache
foo/Bar/Baz.java:1:     PackageCase:    Package name contains upper case characters

Running PMD through: CLI | Ant | Maven | Gradle | Designer | Other

Metadata

Metadata

Assignees

Labels

a:bugPMD crashes or fails to analyse a file.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions