forked from phoedos/pmd
Remove dead container
- The values were stored but never read
This commit is contained in:
@ -58,10 +58,8 @@ public class UnnecessaryImportRule extends AbstractJavaRule {
|
|||||||
private static final String IMPORT_FROM_SAME_PACKAGE_MESSAGE = "Unnecessary import from the current package ''{0}''";
|
private static final String IMPORT_FROM_SAME_PACKAGE_MESSAGE = "Unnecessary import from the current package ''{0}''";
|
||||||
private static final String IMPORT_FROM_JAVA_LANG_MESSAGE = "Unnecessary import from the java.lang package ''{0}''";
|
private static final String IMPORT_FROM_JAVA_LANG_MESSAGE = "Unnecessary import from the java.lang package ''{0}''";
|
||||||
|
|
||||||
private final Set<ImportWrapper> staticImports = new HashSet<>();
|
|
||||||
private final Set<ImportWrapper> allSingleNameImports = new HashSet<>();
|
private final Set<ImportWrapper> allSingleNameImports = new HashSet<>();
|
||||||
private final Set<ImportWrapper> allImportsOnDemand = new HashSet<>();
|
private final Set<ImportWrapper> allImportsOnDemand = new HashSet<>();
|
||||||
private final Set<ImportWrapper> staticImportsOnDemand = new HashSet<>();
|
|
||||||
private final Set<ImportWrapper> unnecessaryJavaLangImports = new HashSet<>();
|
private final Set<ImportWrapper> unnecessaryJavaLangImports = new HashSet<>();
|
||||||
private final Set<ImportWrapper> unnecessaryImportsFromSamePackage = new HashSet<>();
|
private final Set<ImportWrapper> unnecessaryImportsFromSamePackage = new HashSet<>();
|
||||||
|
|
||||||
@ -101,8 +99,6 @@ public class UnnecessaryImportRule extends AbstractJavaRule {
|
|||||||
@Override
|
@Override
|
||||||
public Object visit(ASTCompilationUnit node, Object data) {
|
public Object visit(ASTCompilationUnit node, Object data) {
|
||||||
this.allSingleNameImports.clear();
|
this.allSingleNameImports.clear();
|
||||||
this.staticImports.clear();
|
|
||||||
this.staticImportsOnDemand.clear();
|
|
||||||
this.allImportsOnDemand.clear();
|
this.allImportsOnDemand.clear();
|
||||||
this.unnecessaryJavaLangImports.clear();
|
this.unnecessaryJavaLangImports.clear();
|
||||||
this.unnecessaryImportsFromSamePackage.clear();
|
this.unnecessaryImportsFromSamePackage.clear();
|
||||||
@ -214,12 +210,6 @@ public class UnnecessaryImportRule extends AbstractJavaRule {
|
|||||||
// duplicate
|
// duplicate
|
||||||
reportWithMessage(node, data, DUPLICATE_IMPORT_MESSAGE);
|
reportWithMessage(node, data, DUPLICATE_IMPORT_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.isStatic()) {
|
|
||||||
container = node.isImportOnDemand() ? staticImportsOnDemand
|
|
||||||
: staticImports;
|
|
||||||
container.add(new ImportWrapper(node));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reportWithMessage(ASTImportDeclaration node, Object data, String message) {
|
private void reportWithMessage(ASTImportDeclaration node, Object data, String message) {
|
||||||
|
Reference in New Issue
Block a user