Decrease visibility of public constructor in non-public classes. #1555

Fixes `PublicConstructorInNonPublicClass` inspection violations.

Description:
>Reports all constructors in non-public classes that are declared public.
This commit is contained in:
Michal Kordas 2015-08-21 23:43:25 +02:00 committed by Roman Ivanov
parent 3b452a2e88
commit 8abfa48f2e
21 changed files with 24 additions and 24 deletions

View File

@ -424,7 +424,7 @@ public final class ConfigurationLoader {
* @throws SAXException if an error occurs
* @throws ParserConfigurationException if an error occurs
*/
public InternalLoader()
InternalLoader()
throws SAXException, ParserConfigurationException {
super(createIdToResourceNameMap());
}

View File

@ -49,7 +49,7 @@ class PackageObjectFactory implements ModuleFactory {
* @param moduleClassLoader class loader used to load Checkstyle
* core and custom modules
*/
public PackageObjectFactory(Set<String> packageNames,
PackageObjectFactory(Set<String> packageNames,
ClassLoader moduleClassLoader) {
if (moduleClassLoader == null) {
throw new IllegalArgumentException(

View File

@ -323,7 +323,7 @@ public abstract class AbstractDeclarationCollector extends Check {
* Creates new instance of ClassFrame
* @param parent parent frame
*/
public ClassFrame(LexicalFrame parent) {
ClassFrame(LexicalFrame parent) {
super(parent);
instanceMembers = Sets.newHashSet();
instanceMethods = Sets.newHashSet();

View File

@ -429,7 +429,7 @@ public abstract class AbstractTypeAwareCheck extends Check {
* @param surroundingClass name of current surrounding class.
* @param check the check we use to load class.
*/
public RegularClass(final Token name,
RegularClass(final Token name,
final String surroundingClass,
final AbstractTypeAwareCheck check) {
super(name);

View File

@ -449,7 +449,7 @@ public class SuppressWarningsHolder
* @param lastLine the last line of the suppression region
* @param lastColumn the last column of the suppression region
*/
public Entry(String checkName, int firstLine, int firstColumn,
Entry(String checkName, int firstLine, int firstColumn,
int lastLine, int lastColumn) {
this.checkName = checkName;
this.firstLine = firstLine;

View File

@ -204,7 +204,7 @@ public abstract class AbstractSuperCheck
* Constructs a stack node for a method definition.
* @param ast AST for the method definition.
*/
public MethodNode(DetailAST ast) {
MethodNode(DetailAST ast) {
method = ast;
callingSuper = false;
}

View File

@ -543,7 +543,7 @@ public class HiddenFieldCheck
* @param staticType is this a static inner type (class or enum).
* @param frameName name associated with the frame, which can be a
*/
public FieldFrame(FieldFrame parent, boolean staticType, String frameName) {
FieldFrame(FieldFrame parent, boolean staticType, String frameName) {
this.parent = parent;
this.staticType = staticType;
this.frameName = frameName;

View File

@ -187,7 +187,7 @@ public final class ReturnCountCheck extends AbstractFormatCheck {
* Creates new method context.
* @param checking should we check this method or not.
*/
public Context(boolean checking) {
Context(boolean checking) {
this.checking = checking;
count = 0;
}

View File

@ -646,7 +646,7 @@ public abstract class AbstractJavadocCheck extends Check {
* @param messageKey message key
* @param messageArguments message arguments
*/
public ParseErrorMessage(int lineNumber, String messageKey, Object ... messageArguments) {
ParseErrorMessage(int lineNumber, String messageKey, Object ... messageArguments) {
this.lineNumber = lineNumber;
this.messageKey = messageKey;
this.messageArguments = messageArguments.clone();

View File

@ -210,7 +210,7 @@ public abstract class AbstractClassCouplingCheck extends Check {
* @param lineNo line of class definition.
* @param columnNo column of class definition.
*/
public Context(String className, int lineNo, int columnNo) {
Context(String className, int lineNo, int columnNo) {
this.className = className;
this.lineNo = lineNo;
this.columnNo = columnNo;

View File

@ -229,7 +229,7 @@ public final class BooleanExpressionComplexityCheck extends Check {
* Creates new instance.
* @param checking should we check in current context or not.
*/
public Context(boolean checking) {
Context(boolean checking) {
this.checking = checking;
count = 0;
}

View File

@ -203,7 +203,7 @@ public final class ExecutableStatementCountCheck
* Creates new member context.
* @param ast member AST node.
*/
public Context(DetailAST ast) {
Context(DetailAST ast) {
this.ast = ast;
count = 0;
}

View File

@ -47,7 +47,7 @@ class CSVFilter implements IntFilter {
* @throws NumberFormatException if a component substring does not
* contain a parsable integer.
*/
public CSVFilter(String pattern) {
CSVFilter(String pattern) {
final StringTokenizer tokenizer = new StringTokenizer(pattern, ",");
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken().trim();

View File

@ -31,7 +31,7 @@ class IntMatchFilter implements IntFilter {
* Constructs a MatchFilter for an int.
* @param matchValue the matching int.
*/
public IntMatchFilter(int matchValue) {
IntMatchFilter(int matchValue) {
this.matchValue = matchValue;
}

View File

@ -38,7 +38,7 @@ class IntRangeFilter implements IntFilter {
* @param lowerBound the lower bound of the range.
* @param upperBound the upper bound of the range.
*/
public IntRangeFilter(int lowerBound, int upperBound) {
IntRangeFilter(int lowerBound, int upperBound) {
this.lowerBound = lowerBound;
this.upperBound = upperBound;
}

View File

@ -245,7 +245,7 @@ class FileDrop {
private final Border dragBorder;
private final Listener listener;
public FileDropTargetListener(Component component, Border dragBorder, Listener listener) {
FileDropTargetListener(Component component, Border dragBorder, Listener listener) {
this.component = component;
this.dragBorder = dragBorder;
this.listener = listener;

View File

@ -195,7 +195,7 @@ public class JTreeTable extends JTable {
private int visibleRow;
/** Creates a new instance */
public TreeTableCellRenderer(TreeModel model) {
TreeTableCellRenderer(TreeModel model) {
super(model);
}

View File

@ -44,7 +44,7 @@ class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
/**
* @param jTreeTable TreeTable to perform updates on.
*/
public ListToTreeSelectionModelWrapper(JTreeTable jTreeTable) {
ListToTreeSelectionModelWrapper(JTreeTable jTreeTable) {
treeTable = jTreeTable;
getListSelectionModel().addListSelectionListener(createListSelectionListener());
}

View File

@ -94,7 +94,7 @@ public final class Main {
/**
* Contstructor
*/
public FrameShower(JFrame frame) {
FrameShower(JFrame frame) {
this.frame = frame;
}

View File

@ -223,7 +223,7 @@ public class ParseTreeInfoPanel extends JPanel {
/**
* Contstructor
*/
public FrameShower(Component parent, final String msg) {
FrameShower(Component parent, final String msg) {
this.parent = parent;
this.msg = msg;
}
@ -258,7 +258,7 @@ public class ParseTreeInfoPanel extends JPanel {
*/
private static final long serialVersionUID = -1926935338069418119L;
public FileSelectionAction() {
FileSelectionAction() {
super("Select Java File");
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_S);
}
@ -283,7 +283,7 @@ public class ParseTreeInfoPanel extends JPanel {
*/
private static final long serialVersionUID = -1021880396046355863L;
public ReloadAction() {
ReloadAction() {
super("Reload Java File");
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_R);
}
@ -299,7 +299,7 @@ public class ParseTreeInfoPanel extends JPanel {
private class FileDropListener implements FileDrop.Listener {
private final JScrollPane scrollPane;
public FileDropListener(JScrollPane scrollPane) {
FileDropListener(JScrollPane scrollPane) {
this.scrollPane = scrollPane;
}

View File

@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
class DebugChecker extends Checker {
public DebugChecker() {
DebugChecker() {
}
@Override