@@ -0,0 +1,2379 @@
+/*%0A * Copyright 2005 Bas Leijdekkers%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.siyeh.ig.imports;%0A%0Aimport com.intellij.psi.*;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Apublic class StaticImportIsUsedVisitor extends PsiRecursiveElementVisitor %7B%0A%0A    private final PsiImportStaticStatement m_import;%0A    private boolean m_used = false;%0A%0A    StaticImportIsUsedVisitor(PsiImportStaticStatement importStatement) %7B%0A        super();%0A        m_import = importStatement;%0A    %7D%0A%0A    public void visitElement(PsiElement element) %7B%0A        if (m_used) %7B%0A            return;%0A        %7D%0A        super.visitElement(element);%0A    %7D%0A%0A    public void visitReferenceElement(%0A            @NotNull PsiJavaCodeReferenceElement reference) %7B%0A        followReferenceToImport(reference);%0A        super.visitReferenceElement(reference);%0A    %7D%0A%0A    private void followReferenceToImport(%0A            PsiJavaCodeReferenceElement reference) %7B%0A        if (reference.getQualifier()!=null) %7B%0A            //it's already fully qualified, so the import statement wasn't%0A            // responsible%0A            return;%0A        %7D%0A        final String referenceName = m_import.getReferenceName();%0A        final String qualifiedName = reference.getQualifiedName();%0A        if (referenceName != null && !referenceName.equals(qualifiedName)) %7B%0A            return;%0A        %7D%0A        final PsiClass targetClass =%0A                m_import.resolveTargetClass();%0A        final PsiElement element = reference.resolve();%0A        if (!(element instanceof PsiMember)) %7B%0A            return;%0A        %7D%0A        final PsiMember member = (PsiMember)element;%0A        final PsiClass containingClass = member.getContainingClass();%0A        if (containingClass != null && containingClass.equals(targetClass)) %7B%0A            m_used = true;%0A        %7D%0A    %7D%0A%0A    public boolean isUsed() %7B%0A        return m_used;%0A    %7D%0A%7D

fix for IDEADEV-3938 and significant performance enhancement