inference: skip unchecked warning for types based on inference variables (IDEA-151761)

This commit is contained in:
Anna Kozlova
2016-02-16 17:24:42 +01:00
parent ff1f842740
commit 8fdf37e038
3 changed files with 16 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ public class TypeCompatibilityConstraint implements ConstraintFormula {
final PsiClassType.ClassResolveResult sResult = ((PsiClassType)s).resolveGenerics();
final PsiClass tClass = tResult.getElement();
final PsiClass sClass = sResult.getElement();
if (tClass != null && sClass != null) {
if (tClass != null && sClass != null && !(sClass instanceof InferenceVariable)) {
final PsiSubstitutor sSubstitutor = TypeConversionUtil.getClassSubstitutor(tClass, sClass, sResult.getSubstitutor());
if (sSubstitutor != null) {
if (PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {

View File

@@ -0,0 +1,11 @@
import java.util.List;
class Test {
void m(Class<List> clazz){
List<Object[]> data = foo(clazz);
}
public static <T> T foo(Class<? super T> clazz) {
return null;
}
}

View File

@@ -379,6 +379,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
public void testUncheckedWarningConvertingToInferenceVariable() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}