mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
inference: skip unchecked warning for types based on inference variables (IDEA-151761)
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -379,6 +379,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUncheckedWarningConvertingToInferenceVariable() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user