mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
capture getClass type inside expressions list (IDEA-57877)
This commit is contained in:
@@ -177,7 +177,7 @@ public class PsiTypesUtil {
|
||||
final PsiClassType classType = JavaPsiFacade.getInstance(project).getElementFactory()
|
||||
.createType(javaLangClass, substitutor, languageLevel);
|
||||
final PsiElement parent = call.getParent();
|
||||
return parent instanceof PsiReferenceExpression && parent.getParent() instanceof PsiMethodCallExpression
|
||||
return parent instanceof PsiReferenceExpression && parent.getParent() instanceof PsiMethodCallExpression || parent instanceof PsiExpressionList
|
||||
? PsiUtil.captureToplevelWildcards(classType, methodExpression) : classType;
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
{
|
||||
Object obj = new Object();
|
||||
<error descr="Incompatible types. Found: 'java.util.Set<java.lang.Class<capture<? extends java.lang.Object>>>', required: 'java.util.Set<java.lang.Class<?>>'">Set<Class<?>> types = Collections.singleton(obj.getClass());</error>
|
||||
}
|
||||
}
|
||||
@@ -235,6 +235,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA20244() throws Exception { doTest5(false);}
|
||||
public void testIDEA22005() throws Exception { doTest5(false);}
|
||||
|
||||
public void testIDEA57877() 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); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user