do not accept deep bound promotion in type parameters withing bound check (IDEA-107654)

This commit is contained in:
Anna Kozlova
2013-06-04 14:18:45 +04:00
parent 399d857d8c
commit 42ece72f79
3 changed files with 8 additions and 0 deletions
@@ -350,6 +350,7 @@ public class GenericsHighlightUtil {
return false;
}
}
if (psiClass instanceof PsiTypeParameter && psiClass.getExtendsListTypes().length != 0) return false;
}
if (!type.isRaw()) return true;
//allow unchecked conversions in method calls but not in type declaration
@@ -0,0 +1,3 @@
class X<A extends X<A>> {
static class Y<B extends Y> extends X<<error descr="Type parameter 'B' is not within its bound; should extend 'X<B>'">B</error>> {}
}
@@ -247,6 +247,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testCaptureTopLevelWildcardsForConditionalExpression() throws Exception { doTest5(false);}
public void testGenericsOverrideMethodInRawInheritor() throws Exception { doTest5(false);}
public void testIDEA107654() 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); }
public void testTypeArgumentsOnRawType(){ doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }