annotation type: error for duplicated methods (IDEA-128675)

This commit is contained in:
Anna Kozlova
2014-08-18 13:20:48 +04:00
parent 81fc7616bf
commit 2a41b7a9c3
3 changed files with 11 additions and 1 deletions

View File

@@ -257,8 +257,13 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
}
myHolder.add(AnnotationsHighlightUtil.checkValidAnnotationType(method.getReturnTypeElement()));
myHolder.add(AnnotationsHighlightUtil.checkCyclicMemberType(method.getReturnTypeElement(), method.getContainingClass()));
final PsiClass aClass = method.getContainingClass();
myHolder.add(AnnotationsHighlightUtil.checkCyclicMemberType(method.getReturnTypeElement(), aClass));
myHolder.add(AnnotationsHighlightUtil.checkClashesWithSuperMethods(method));
if (!myHolder.hasErrorResults() && aClass != null) {
myHolder.add(HighlightMethodUtil.checkDuplicateMethod(aClass, method, getDuplicateMethods(aClass)));
}
}
@Override

View File

@@ -0,0 +1,4 @@
@interface Example {
<error descr="'myMethod()' is already defined in 'Example'">public String myMethod()</error>;
<error descr="'myMethod()' is already defined in 'Example'">public int myMethod()</error>;
}

View File

@@ -41,6 +41,7 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testDuplicateTarget() { doTest(false); }
public void testPingPongAnnotationTypesDependencies() { doTest(false);}
public void testClashMethods() { doTest(false);}
public void testDupMethods() { doTest(false);}
public void testInvalidPackageAnnotationTarget() { doTest(BASE_PATH + "/" + getTestName(true) + "/package-info.java", false, false); }
public void testPackageAnnotationNotInPackageInfo() { doTest(BASE_PATH + "/" + getTestName(true) + "/notPackageInfo.java", false, false); }