SOE (IDEA-69752 )

This commit is contained in:
anna
2011-09-06 11:54:45 +02:00
parent c09410b3b5
commit ca2c3bc539
3 changed files with 26 additions and 1 deletions
@@ -298,7 +298,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
PsiType substitutedBoundType = boundType.accept(mySimpleSubstitutionVisitor);
PsiWildcardType wildcardType = (PsiWildcardType)substituted;
if (substitutedBoundType != null && !(substitutedBoundType instanceof PsiWildcardType) && !substitutedBoundType.equalsToText("java.lang.Object")) {
if (originalBound == null || !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(originalBound)) { //erasure is essential to avoid infinite recursion
if (originalBound == null || !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(TypeConversionUtil.erasure(originalBound))) { //erasure is essential to avoid infinite recursion
if (wildcardType.isExtends()) {
final PsiType glb = GenericsUtil.getGreatestLowerBound(wildcardType.getBound(), substitutedBoundType);
if (glb != null) {
@@ -0,0 +1,24 @@
public class SOE {
}
abstract class VersionEntity<V extends Version<V, R>, R extends Ref<V, R>>
implements Version<V, R>{}
interface Version<V extends Version<V, R>, R extends Ref<V, R>>{}
abstract class RefEntity<V extends Version<V, R>, R extends Ref<V, R>>
implements Ref<V, R> {}
interface Ref<V extends Version<V, R>, R extends Ref<V, R>>{}
abstract class Node<G extends Node<G, GR>,
GR extends NodeRef<G, GR>> extends VersionEntity<G, GR> {}
abstract class NodeRef<G extends Node<G, GR>, GR extends NodeRef<G, GR>> extends RefEntity<G, GR> {}
class D {
void f() {
Version v = new Node<<error descr="Wildcard type '?' cannot be instantiated directly">?</error>, <error descr="Wildcard type '?' cannot be instantiated directly">?</error>>(){}<EOLError descr="';' expected"></EOLError>
}
}
@@ -81,6 +81,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEADEV24166() throws Exception { doTest(true); }
public void testIDEADEV25778() throws Exception { doTest(true); }
public void testIDEADEV57343() throws Exception { doTest(false); }
public void testSOE() throws Exception { doTest(true); }
public void testGenericExtendException() throws Exception { doTest(false); }
public void testSameErasureDifferentReturnTypes() throws Exception { doTest(false); }