forked from phoedos/pmd
[java] CommentDefaultAccessModifierRule
* refactor * extend documentation
This commit is contained in:
@ -115,15 +115,7 @@ public class CommentDefaultAccessModifierRule extends AbstractIgnoredAnnotationR
|
||||
// if is a default access modifier check if there is a comment
|
||||
// in this line
|
||||
&& !interestingLineNumberComments.contains(decl.getBeginLine())
|
||||
// that it is not annotated with @VisibleForTesting
|
||||
&& hasNoVisibleForTestingAnnotation(decl);
|
||||
}
|
||||
|
||||
private boolean hasNoVisibleForTestingAnnotation(AbstractJavaAccessNode decl) {
|
||||
boolean result = true;
|
||||
if (hasIgnoredAnnotation(decl)) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
// that it is not annotated with e.g. @VisibleForTesting
|
||||
&& !hasIgnoredAnnotation(decl);
|
||||
}
|
||||
}
|
||||
|
@ -399,6 +399,8 @@ public class Éléphant {}
|
||||
To avoid mistakes if we want that a Method, Constructor, Field or Nested class have a default access modifier
|
||||
we must add a comment at the beginning of it's declaration.
|
||||
By default the comment must be /* default */ or /* package */, if you want another, you have to provide a regular expression.
|
||||
This rule ignores by default all cases that have a @VisibleForTesting annotation. Use the
|
||||
property "ignoredAnnotations" to customize the recognized annotations.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
|
Reference in New Issue
Block a user