Skip to content

Commit

Permalink
Issue checkstyle#5665: Enable PMD rule CommentDefaultAccessModifier
Browse files Browse the repository at this point in the history
  • Loading branch information
pbludov authored and Vantuz committed Apr 3, 2019
1 parent 44dfb72 commit 51bc8fe
Show file tree
Hide file tree
Showing 47 changed files with 57 additions and 55 deletions.
2 changes: 0 additions & 2 deletions config/pmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@
<!-- Calling super() is completely pointless, no matter if class inherits anything or not;
it is meaningful only if you do not call implicit constructor of the base class. -->
<exclude name="CallSuperInConstructor"/>
<!-- Till https://github.com/checkstyle/checkstyle/issues/5665 -->
<exclude name="CommentDefaultAccessModifier"/>
<!-- Pollutes code with modifiers. -->
<exclude name="LocalVariableCouldBeFinal"/>
<!-- Pollutes the code with modifiers. We use the ParameterAssignmentCheck to protect the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private static final class ViolationPosition {
private final int violationLineNumber;
private final int violationColumnNumber;

ViolationPosition(int violationLineNumber,
/* package */ ViolationPosition(int violationLineNumber,
int violationColumnNumber) {
this.violationLineNumber = violationLineNumber;
this.violationColumnNumber = violationColumnNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ private final class InternalLoader
* @throws SAXException if an error occurs
* @throws ParserConfigurationException if an error occurs
*/
InternalLoader()
/* package */ InternalLoader()
throws SAXException, ParserConfigurationException {
super(createIdToResourceNameMap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ public static class ParseErrorMessage {
* @param messageKey message key
* @param messageArguments message arguments
*/
ParseErrorMessage(int lineNumber, String messageKey, Object... messageArguments) {
/* package */ ParseErrorMessage(int lineNumber, String messageKey,
Object... messageArguments) {
this.lineNumber = lineNumber;
this.messageKey = messageKey;
this.messageArguments = messageArguments.clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private static class ExternalResource {
* @param location resource location.
* @param contentHashSum content hash sum.
*/
ExternalResource(String location, String contentHashSum) {
/* package */ ExternalResource(String location, String contentHashSum) {
this.location = location;
this.contentHashSum = contentHashSum;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ private static class Entry {
* @param lastLine the last line of the suppression region
* @param lastColumn the last column of the suppression region
*/
Entry(String checkName, int firstLine, int firstColumn,
/* package */ Entry(String checkName, int firstLine, int firstColumn,
int lastLine, int lastColumn) {
this.checkName = checkName;
this.firstLine = firstLine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ private static class ResourceBundle {
* @param path common path of files which are included in the resource bundle.
* @param extension common extension of files which are included in the resource bundle.
*/
ResourceBundle(String baseName, String path, String extension) {
/* package */ ResourceBundle(String baseName, String path, String extension) {
this.baseName = baseName;
this.path = path;
this.extension = extension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private static class MethodNode {
* Constructs a stack node for a method definition.
* @param ast AST for the method definition.
*/
MethodNode(DetailAST ast) {
/* package */ MethodNode(DetailAST ast) {
method = ast;
callingSuper = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private static class FieldFrame {
* Creates new frame.
* @param parent parent frame.
*/
FieldFrame(FieldFrame parent) {
/* package */ FieldFrame(FieldFrame parent) {
this.parent = parent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ private static class FinalVariableCandidate {
* Creates new instance.
* @param variableIdent variable identifier.
*/
FinalVariableCandidate(DetailAST variableIdent) {
/* package */ FinalVariableCandidate(DetailAST variableIdent) {
this.variableIdent = variableIdent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ private static class FieldFrame {
* @param staticType is this a static inner type (class or enum).
* @param frameName name associated with the frame, which can be a
*/
FieldFrame(FieldFrame parent, boolean staticType, String frameName) {
/* package */ FieldFrame(FieldFrame parent, boolean staticType, String frameName) {
this.parent = parent;
this.staticType = staticType;
this.frameName = frameName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ private static class ClassFrame extends AbstractFrame {
* @param parent parent frame.
* @param ident frame name ident.
*/
ClassFrame(AbstractFrame parent, DetailAST ident) {
/* package */ ClassFrame(AbstractFrame parent, DetailAST ident) {
super(parent, ident);
instanceMembers = new HashSet<>();
instanceMethods = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private class Context {
* Creates new method context.
* @param checking should we check this method or not.
*/
Context(boolean checking) {
/* package */ Context(boolean checking) {
this.checking = checking;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ private static final class ClassDesc {
* @param declaredAsAbstract indicates if the
* class declared as abstract
*/
ClassDesc(String qualifiedName, boolean declaredAsFinal, boolean declaredAsAbstract) {
/* package */ ClassDesc(String qualifiedName, boolean declaredAsFinal,
boolean declaredAsAbstract) {
this.qualifiedName = qualifiedName;
this.declaredAsFinal = declaredAsFinal;
this.declaredAsAbstract = declaredAsAbstract;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private static class Details {
* C-tor.
* @param ast class ast
* */
Details(DetailAST ast) {
/* package */ Details(DetailAST ast) {
this.ast = ast;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ abstract class AbstractImportControl {
* @param parent the parent node.
* @param strategyOnMismatch strategy in a case if matching allow/disallow rule was not found.
*/
AbstractImportControl(AbstractImportControl parent, MismatchStrategy strategyOnMismatch) {
protected AbstractImportControl(AbstractImportControl parent,
MismatchStrategy strategyOnMismatch) {
this.parent = parent;
this.strategyOnMismatch = strategyOnMismatch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ClassImportRule extends AbstractImportRule {
* @param regExp whether the class name is to be interpreted as a regular
* expression.
*/
ClassImportRule(final boolean allow, final boolean localOnly,
/* package */ ClassImportRule(final boolean allow, final boolean localOnly,
final String className, final boolean regExp) {
super(allow, localOnly, regExp);
this.className = className;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ private static class ImportDetails {
* @param staticImport
* if import is static.
*/
ImportDetails(String importFullPath,
/* package */ ImportDetails(String importFullPath,
int lineNumber, String importGroup, boolean staticImport) {
this.importFullPath = importFullPath;
this.lineNumber = lineNumber;
Expand Down Expand Up @@ -942,7 +942,7 @@ private static class RuleMatchForImport {
* @param position
* Matching position.
*/
RuleMatchForImport(String group, int length, int position) {
/* package */ RuleMatchForImport(String group, int length, int position) {
this.group = group;
matchLength = length;
matchPosition = position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileImportControl extends AbstractImportControl {
* @param name the name of the file.
* @param regex flags interpretation of name as regex pattern.
*/
FileImportControl(PkgImportControl parent, String name, boolean regex) {
/* package */ FileImportControl(PkgImportControl parent, String name, boolean regex) {
super(parent, MismatchStrategy.DELEGATE_TO_PARENT);

this.regex = regex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class PkgImportControl extends AbstractImportControl {
* @param regex flags interpretation of name as regex pattern.
* @param strategyOnMismatch strategy in a case if matching allow/disallow rule was not found.
*/
PkgImportControl(String packageName, boolean regex, MismatchStrategy strategyOnMismatch) {
/* package */ PkgImportControl(String packageName, boolean regex,
MismatchStrategy strategyOnMismatch) {
super(null, strategyOnMismatch);

this.regex = regex;
Expand All @@ -82,7 +83,7 @@ class PkgImportControl extends AbstractImportControl {
* @param regex flags interpretation of name as regex pattern.
* @param strategyOnMismatch strategy in a case if matching allow/disallow rule was not found.
*/
PkgImportControl(PkgImportControl parent, String subPackageName, boolean regex,
/* package */ PkgImportControl(PkgImportControl parent, String subPackageName, boolean regex,
MismatchStrategy strategyOnMismatch) {
super(parent, strategyOnMismatch);
if (regex || parent.regex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PkgImportRule extends AbstractImportRule {
* @param regExp whether the package name is to be interpreted as a regular
* expression.
*/
PkgImportRule(final boolean allow, final boolean localOnly,
/* package */ PkgImportRule(final boolean allow, final boolean localOnly,
final String pkgName, final boolean exactMatch, final boolean regExp) {
super(allow, localOnly, regExp);
this.pkgName = pkgName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private static final class RegularClass extends AbstractClassInfo {
* @param surroundingClass name of current surrounding class.
* @param check the check we use to load class.
*/
RegularClass(final Token name,
/* package */ RegularClass(final Token name,
final String surroundingClass,
final AbstractTypeAwareCheck check) {
super(name);
Expand Down Expand Up @@ -504,7 +504,7 @@ private static class ClassAlias extends AbstractClassInfo {
* @param name token which represents name of class alias.
* @param classInfo class information associated with the alias.
*/
ClassAlias(final Token name, AbstractClassInfo classInfo) {
/* package */ ClassAlias(final Token name, AbstractClassInfo classInfo) {
super(name);
this.classInfo = classInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class HtmlTag {
* @param incomplete is the tag is incomplete.
* @param text the line of comment text for this tag.
*/
HtmlTag(String id, int lineNo, int position, boolean closedTag,
/* package */ HtmlTag(String id, int lineNo, int position, boolean closedTag,
boolean incomplete, String text) {
this.id = id;
this.lineNo = lineNo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ private static class ExceptionInfo {
*
* @param classInfo class info
*/
ExceptionInfo(AbstractClassInfo classInfo) {
/* package */ ExceptionInfo(AbstractClassInfo classInfo) {
this.classInfo = classInfo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TagParser {
* @param text the line of text to parse.
* @param lineNo the source line number.
*/
TagParser(String[] text, int lineNo) {
/* package */ TagParser(String[] text, int lineNo) {
parseTags(text, lineNo);
}

Expand Down Expand Up @@ -285,7 +285,7 @@ private static final class Point {
* @param lineNo line number
* @param columnNo column number
*/
Point(int lineNo, int columnNo) {
/* package */ Point(int lineNo, int columnNo) {
this.lineNo = lineNo;
this.columnNo = columnNo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ private class ClassContext {
* @param className name of the given class.
* @param ast ast of class definition.
*/
ClassContext(FileContext parentContext, String className, DetailAST ast) {
/* package */ ClassContext(FileContext parentContext, String className, DetailAST ast) {
this.parentContext = parentContext;
this.className = className;
classAst = ast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private class Context {
* Creates new instance.
* @param checking should we check in current context or not.
*/
Context(boolean checking) {
/* package */ Context(boolean checking) {
this.checking = checking;
count = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private static class Values {
* @param valueOfRange NP value for range
* @param valueOfExpression NP value for expression
*/
Values(BigInteger valueOfRange, BigInteger valueOfExpression) {
/* package */ Values(BigInteger valueOfRange, BigInteger valueOfExpression) {
rangeValue = valueOfRange;
expressionValue = valueOfExpression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CommentSuppressor implements MatchSuppressor {
* @param currentContents
* content of checked file.
**/
CommentSuppressor(FileContents currentContents) {
/* package */ CommentSuppressor(FileContents currentContents) {
this.currentContents = currentContents;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MultilineDetector {
* Creates an instance.
* @param options the options to use.
*/
MultilineDetector(DetectorOptions options) {
/* package */ MultilineDetector(DetectorOptions options) {
this.options = options;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SinglelineDetector {
* Creates an instance.
* @param options the options to use.
*/
SinglelineDetector(DetectorOptions options) {
/* package */ SinglelineDetector(DetectorOptions options) {
this.options = options;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private static class Context {
* Creates new member context.
* @param ast member AST node.
*/
Context(DetailAST ast) {
/* package */ Context(DetailAST ast) {
this.ast = ast;
count = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private static class MethodCounter {
* The surrounding scope definition (class, enum, etc.) which to count all methods
* for.
*/
MethodCounter(DetailAST scopeDefinition) {
/* package */ MethodCounter(DetailAST scopeDefinition) {
this.scopeDefinition = scopeDefinition;
inInterface = scopeDefinition.getType() == TokenTypes.INTERFACE_DEF;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CsvFilterElement implements IntFilterElement {
* @throws NumberFormatException if a component substring does not
* contain a parsable integer.
*/
CsvFilterElement(String pattern) {
/* package */ CsvFilterElement(String pattern) {
final StringTokenizer tokenizer = new StringTokenizer(pattern, ",");
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken().trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IntMatchFilterElement implements IntFilterElement {
* Constructs a MatchFilter for an int.
* @param matchValue the matching int.
*/
IntMatchFilterElement(int matchValue) {
/* package */ IntMatchFilterElement(int matchValue) {
this.matchValue = matchValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IntRangeFilterElement implements IntFilterElement {
* @param lowerBound the lower bound of the range.
* @param upperBound the upper bound of the range.
*/
IntRangeFilterElement(int lowerBound, int upperBound) {
/* package */ IntRangeFilterElement(int lowerBound, int upperBound) {
this.lowerBound = lowerBound;
this.upperBound = upperBound;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
* Constructor to initialise treeTable.
* @param jTreeTable TreeTable to perform updates on.
*/
ListToTreeSelectionModelWrapper(TreeTable jTreeTable) {
/* package */ ListToTreeSelectionModelWrapper(TreeTable jTreeTable) {
treeTable = jTreeTable;
getListSelectionModel().addListSelectionListener(event -> {
updateSelectedPathsFromSelectedRows();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TreeTableCellRenderer extends JTree implements
* @param treeTable tree table to render.
* @param model Tree model.
*/
TreeTableCellRenderer(TreeTable treeTable, TreeModel model) {
/* package */ TreeTableCellRenderer(TreeTable treeTable, TreeModel model) {
super(model);
this.treeTable = treeTable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private static final class CountComments {
private final List<String> lineComments = new ArrayList<>();
private final List<String> blockComments = new ArrayList<>();

CountComments(DetailAST root) {
/* package */ CountComments(DetailAST root) {
forEachChild(root);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private static class TestUrlsClassLoader extends ClassLoader {

private final Enumeration<URL> urls;

TestUrlsClassLoader(Enumeration<URL> urls) {
/* package */ TestUrlsClassLoader(Enumeration<URL> urls) {
this.urls = urls;
}

Expand Down
Loading

0 comments on commit 51bc8fe

Please sign in to comment.