boolean (PsiImportStaticStatement importStatement) { final PsiJavaCodeReferenceElement importReference = importStatement.getImportReference(); if (importReference == null || importReference.multiResolve(false).length == 0) { return false; } PsiClass targetClass = importStatement.resolveTargetClass(); boolean checked = false; while (targetClass != null) { final String qualifiedName = targetClass.getQualifiedName(); if (allowedClasses.contains(qualifiedName)) { return false; } if (checked) { break; } targetClass = targetClass.getContainingClass(); checked = true; } if (importStatement.isOnDemand()) { return true; } if (ignoreSingleFieldImports || ignoreSingeMethodImports) { boolean field = false; boolean method = false; // in the presence of method overloading the plain resolve() method returns null final JavaResolveResult[] results = importReference.multiResolve(false); for (JavaResolveResult result : results) { final PsiElement element = result.getElement(); if (element instanceof PsiField) { field = true; } else if (element instanceof PsiMethod) { method = true; } } if (field && !method) { if (ignoreSingleFieldImports) { return false; } } else if (method && !field) { if (ignoreSingeMethodImports) { return false; } } } return true; }