forked from phoedos/pmd
Merge branch 'pr-821'
This commit is contained in:
commit
9bc7074fb9
@ -55,6 +55,8 @@ at <https://pmd.github.io/latest/>.
|
||||
* java-bestpractices
|
||||
* [#783](https://github.com/pmd/pmd/issues/783): \[java] GuardLogStatement regression
|
||||
* [#800](https://github.com/pmd/pmd/issues/800): \[java] ForLoopCanBeForeach NPE when looping on `this` object
|
||||
* java-codestyle
|
||||
* [#817](https://github.com/pmd/pmd/issues/817): \[java] UnnecessaryModifierRule crashes on valid code
|
||||
* java-design
|
||||
* [#785](https://github.com/pmd/pmd/issues/785): \[java] NPE in DataClass rule
|
||||
|
||||
|
@ -150,9 +150,11 @@ public class UnnecessaryModifierRule extends AbstractJavaRule {
|
||||
private boolean isSafeVarargs(final ASTMethodDeclaration node) {
|
||||
for (final ASTAnnotation annotation : node.jjtGetParent().findChildrenOfType(ASTAnnotation.class)) {
|
||||
final Node childAnnotation = annotation.jjtGetChild(0);
|
||||
if (childAnnotation instanceof ASTMarkerAnnotation
|
||||
&& SafeVarargs.class.isAssignableFrom(((ASTMarkerAnnotation) childAnnotation).getType())) {
|
||||
return true;
|
||||
if (childAnnotation instanceof ASTMarkerAnnotation) {
|
||||
final ASTMarkerAnnotation marker = (ASTMarkerAnnotation) childAnnotation;
|
||||
if (marker.getType() != null && SafeVarargs.class.isAssignableFrom(marker.getType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,6 +585,16 @@ public class Foo {
|
||||
// do something on fw
|
||||
}
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#817 [java] UnnecessaryModifierRule crashes on valid code</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
class Foo {
|
||||
@Bar
|
||||
final void method() { }
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Loading…
x
Reference in New Issue
Block a user