remove duplicate

This commit is contained in:
Max Medvedev
2014-01-30 12:58:16 +04:00
parent a7bab7dd0a
commit 8ed8c4c9bc
2 changed files with 6 additions and 29 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -595,7 +595,7 @@ public class HighlightClassUtil {
}
@Nullable
private static PsiClass getCircularClass(PsiClass aClass, Collection<PsiClass> usedClasses) {
public static PsiClass getCircularClass(PsiClass aClass, Collection<PsiClass> usedClasses) {
if (usedClasses.contains(aClass)) {
return aClass;
}
@@ -17,6 +17,7 @@
package org.jetbrains.plugins.groovy.annotator;
import com.intellij.codeInsight.ClassUtil;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightClassUtil;
import com.intellij.codeInsight.daemon.impl.quickfix.AddMethodBodyFix;
import com.intellij.codeInsight.daemon.impl.quickfix.CreateConstructorMatchingSuperFix;
import com.intellij.codeInsight.daemon.impl.quickfix.DeleteMethodBodyFix;
@@ -1478,7 +1479,8 @@ public class GroovyAnnotator extends GroovyElementVisitor {
}
Map<PsiElement, String> errors = ContainerUtil.newHashMap();
CustomAnnotationChecker.checkAnnotationArguments(errors, anno, annotation.getClassReference(), annotationArgumentList.getAttributes(), true);
CustomAnnotationChecker.checkAnnotationArguments(errors, anno, annotation.getClassReference(), annotationArgumentList.getAttributes(),
true);
for (Map.Entry<PsiElement, String> entry : errors.entrySet()) {
myHolder.createErrorAnnotation(entry.getKey(), entry.getValue());
}
@@ -2022,7 +2024,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
private static void checkCyclicInheritance(AnnotationHolder holder,
GrTypeDefinition typeDefinition) {
final PsiClass psiClass = getCircularClass(typeDefinition, new HashSet<PsiClass>());
final PsiClass psiClass = HighlightClassUtil.getCircularClass(typeDefinition, new HashSet<PsiClass>());
if (psiClass != null) {
String qname = psiClass.getQualifiedName();
assert qname != null;
@@ -2031,31 +2033,6 @@ public class GroovyAnnotator extends GroovyElementVisitor {
}
}
@Nullable
private static PsiClass getCircularClass(PsiClass aClass, Collection<PsiClass> usedClasses) {
if (usedClasses.contains(aClass)) {
return aClass;
}
try {
usedClasses.add(aClass);
PsiClass[] superTypes = aClass.getSupers();
for (PsiElement superType : superTypes) {
while (superType instanceof PsiClass) {
if (!CommonClassNames.JAVA_LANG_OBJECT.equals(((PsiClass)superType).getQualifiedName())) {
PsiClass circularClass = getCircularClass((PsiClass)superType, usedClasses);
if (circularClass != null) return circularClass;
}
// check class qualifier
superType = superType.getParent();
}
}
}
finally {
usedClasses.remove(aClass);
}
return null;
}
private static void checkForWildCards(AnnotationHolder holder, @Nullable GrReferenceList clause) {
if (clause == null) return;
final GrCodeReferenceElement[] elements = clause.getReferenceElementsGroovy();