temp decline raw assignments (IDEA-92022)

This commit is contained in:
anna
2012-11-13 20:18:07 +01:00
parent e1ac2b1977
commit 7cee6ae2b4
3 changed files with 34 additions and 2 deletions
@@ -970,11 +970,19 @@ public class TypeConversionUtil {
}
}
else {
boolean effectiveAllowUncheckedConversion = allowUncheckedConversion;
if (typeRight instanceof PsiCapturedWildcardType) {
effectiveAllowUncheckedConversion = false;
final PsiClass psiClass = PsiUtil.resolveClassInType(((PsiCapturedWildcardType)typeRight).getWildcard().getBound());
if (psiClass != null && !psiClass.hasTypeParameters()) {
effectiveAllowUncheckedConversion = allowUncheckedConversion;
}
}
if (leftWildcard.isExtends()) {
return isAssignable(leftBound, typeRight, allowUncheckedConversion && !containsWildcards(leftBound));
return isAssignable(leftBound, typeRight, effectiveAllowUncheckedConversion && !containsWildcards(leftBound));
}
else { // isSuper
return isAssignable(typeRight, leftBound, allowUncheckedConversion && !containsWildcards(leftBound));
return isAssignable(typeRight, leftBound, effectiveAllowUncheckedConversion && !containsWildcards(leftBound));
}
}
}
@@ -0,0 +1,23 @@
class GetClassClient {
public void use() {
Class<? extends LocalGeneric> v1 = null;
Class<? extends LocalGeneric<Object>> v2 = null;
v1 = v2;
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends GetClassClient.LocalGeneric>>', required: 'java.lang.Class<? extends GetClassClient.LocalGeneric<java.lang.Object>>'">v2 = v1</error>;
}
public static class LocalGeneric<T> {
}
}
interface Comparable<T extends Comparable<T>> {}
class List<T> {}
class Foo implements Comparable<Foo> {
public static void main(String[] args){
List<? extends Foo> list = null;
List<? extends Comparable> c = null;
c = list;
}
}
@@ -193,6 +193,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void _testIDEA94011() throws Exception { doTest(false); }
public void testDifferentTypeParamsInOverloadedMethods() throws Exception { doTest(true); }
public void testIDEA91626() throws Exception { doTest(true); }
public void testIDEA92022() throws Exception { doTest(false); }
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));