You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
The first code sample uses the annotation javax.inject.Inject, and the second one uses com.google.inject.Inject. The analysis results of the two cases should be equivalent because these two annotations are equivalent. However, PMD reports a warning in the second sample and no warnings in the first one. Actually, PMD should not report a warning in Case 2 like the Case 1 because it has a injection here.
Expected outcome: The analysis results of the two classes should be the same and report no violation.
PMD reports a violation at line 2 in the second case, but that's wrong. That's a false positive. PMD should report no violation if PMD sees com.google.inject.Inject.
Running PMD through:CLI
The text was updated successfully, but these errors were encountered:
adangel
changed the title
[java]false-positive about MissingStaticMethodInNonInstantiatableClass and @Inject
[java] MissingStaticMethodInNonInstantiatableClass: false-positive about @Inject
Apr 22, 2023
Affects PMD Version:7.0.0-rc1
Rule: MissingStaticMethodInNonInstantiatableClass
Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_errorprone.html#missingstaticmethodinnoninstantiatableclass
Description:
The first code sample uses the annotation
javax.inject.Inject
, and the second one usescom.google.inject.Inject
. The analysis results of the two cases should be equivalent because these two annotations are equivalent. However, PMD reports a warning in the second sample and no warnings in the first one. Actually, PMD should not report a warning inCase 2
like theCase 1
because it has a injection here.Code Sample demonstrating the issue:
Case 1
Case 2
Expected outcome: The analysis results of the two classes should be the same and report no violation.
PMD reports a violation at line 2 in the second case, but that's wrong. That's a false positive. PMD should report no violation if PMD sees
com.google.inject.Inject
.Running PMD through: CLI
The text was updated successfully, but these errors were encountered: