mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show error if override generics method in raw inheritor (comment IDEA-19718)
This commit is contained in:
+11
@@ -548,6 +548,17 @@ public class GenericsHighlightUtil {
|
||||
for (HierarchicalMethodSignature superSignature : supers) {
|
||||
info = checkSameErasureNotSubSignatureInner(superSignature, manager, aClass, sameErasureMethods);
|
||||
if (info != null) return info;
|
||||
|
||||
if (superSignature.isRaw() && !signature.isRaw()) {
|
||||
final PsiType[] parameterTypes = signature.getParameterTypes();
|
||||
PsiType[] types = superSignature.getParameterTypes();
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (!Comparing.equal(parameterTypes[i], TypeConversionUtil.erasure(types[i]))) {
|
||||
return getSameErasureMessage(false, method, superSignature.getMethod(), HighlightNamesUtil.getClassDeclarationTextRange(aClass));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import java.util.List;
|
||||
|
||||
<error descr="'method(List<String>)' in 'Implementation' clashes with 'method(List<String>)' in 'IfcWithGenericMethod'; both methods have same erasure, yet neither overrides the other">class Implementation implements IfcWithGenericMethod</error> {
|
||||
public void method(final List<String> strings) {}
|
||||
}
|
||||
|
||||
interface IfcWithGenericMethod<T> {
|
||||
void method(List<String> strings);
|
||||
}
|
||||
@@ -237,6 +237,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testIDEA57877() throws Exception { doTest5(false);}
|
||||
public void testCaptureTopLevelWildcardsForConditionalExpression() throws Exception { doTest5(false);}
|
||||
public void testGenericsOverrideMethodInRawInheritor() throws Exception { doTest5(false);}
|
||||
|
||||
public void testIDEA27185(){ doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }
|
||||
public void testIDEA67571(){ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
Reference in New Issue
Block a user