mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
type distinct prover for object/type parameter wildcard fixed IDEA-124363
This commit is contained in:
@@ -57,7 +57,7 @@ public class TypesDistinctProver {
|
||||
final PsiClass boundClass1 = PsiUtil.resolveClassInType(extendsBound);
|
||||
if (boundClass1 == null) return false;
|
||||
|
||||
if (CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass2.getQualifiedName())) {
|
||||
if (CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass2.getQualifiedName()) && !(boundClass1 instanceof PsiTypeParameter)) {
|
||||
return !CommonClassNames.JAVA_LANG_OBJECT.equals(boundClass1.getQualifiedName());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.*;
|
||||
|
||||
class MyTClass {
|
||||
|
||||
<T> void foo(final List<Object> objects){
|
||||
Collection<? extends T> collection = (Collection<? extends T>) objects;
|
||||
}
|
||||
|
||||
<T> void foo1(final List<Object> objects){
|
||||
Collection<? super T> collection = (Collection<? super T>) objects;
|
||||
}
|
||||
|
||||
<T extends String> void bar(final List<Object> objects){
|
||||
Collection<? extends T> collection = <error descr="Inconvertible types; cannot cast 'java.util.List<java.lang.Object>' to 'java.util.Collection<? extends T>'">(Collection<? extends T>) objects</error>;
|
||||
}
|
||||
}
|
||||
@@ -370,6 +370,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA67600() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA126697() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, true); }
|
||||
public void testIDEA126633() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA124363() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
//jdk should propagate LL 1.4 but actually it provides LL 1.7?!
|
||||
public void testCastObjectToIntJdk14() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_4, false); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user