mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
capture top level wildcards when choosing conditional expression type (~IDEA-16723)
This commit is contained in:
@@ -97,7 +97,8 @@ public class PsiConditionalExpressionImpl extends ExpressionPsiElement implement
|
||||
if (type2 == null) return null;
|
||||
}
|
||||
|
||||
return GenericsUtil.getLeastUpperBound(type1, type2, getManager());
|
||||
final PsiType leastUpperBound = GenericsUtil.getLeastUpperBound(type1, type2, getManager());
|
||||
return leastUpperBound != null ? PsiUtil.captureToplevelWildcards(leastUpperBound, this) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
class Bug {
|
||||
void foo(Double d) {
|
||||
<error descr="Incompatible types. Found: 'java.util.List<java.lang.Class<capture<? extends java.lang.Object>>>', required: 'java.util.List<java.lang.Class<?>>'">List<Class<?>> list = Arrays.asList(d == null ? Object.class : d.getClass());</error>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*;
|
||||
class Bug {
|
||||
void foo(Double d) {
|
||||
List<Class<?>> list = Arrays.<Class<?>>asList(d == null ? Object.class : d.getClass());
|
||||
}
|
||||
}
|
||||
@@ -236,6 +236,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA22005() throws Exception { doTest5(false);}
|
||||
|
||||
public void testIDEA57877() throws Exception { doTest5(false);}
|
||||
public void testCaptureTopLevelWildcardsForConditionalExpression() throws Exception { doTest5(false);}
|
||||
|
||||
public void testIDEA27185(){ doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }
|
||||
public void testIDEA67571(){ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
@@ -29,4 +29,8 @@ public class RedundantTypeArgsInspectionTest extends JavaCodeInsightFixtureTestC
|
||||
public void testReturnPrimitiveTypes() throws Throwable { // javac non-boxing: IDEA-53984
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testConditionalExpression() throws Throwable { // javac non-boxing: IDEA-53984
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user