mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
capture wildcards in type casts (IDEA-101862; IDEA-97703)
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.source.tree.java;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.source.Constants;
|
||||
import com.intellij.psi.impl.source.tree.ChildRole;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -46,7 +47,7 @@ public class PsiTypeCastExpressionImpl extends ExpressionPsiElement implements P
|
||||
@Nullable public PsiType getType() {
|
||||
final PsiTypeElement castType = getCastType();
|
||||
if (castType == null) return null;
|
||||
return castType.getType();
|
||||
return PsiImplUtil.normalizeWildcardTypeByPosition(castType.getType(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.Collection;
|
||||
|
||||
class Foo {
|
||||
private void test() {
|
||||
Object x = null;
|
||||
((java.util.Collection<?>)x).add<error descr="'add(capture<?>)' in 'java.util.Collection' cannot be applied to '(java.lang.String)'">("")</error>;
|
||||
}
|
||||
}
|
||||
@@ -304,6 +304,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA110869() { doTest5(false); }
|
||||
public void testIDEA110947() { doTest5(false); }
|
||||
public void testNoInferenceFromTypeCast() { doTest5(false); }
|
||||
public void testCaptureWildcardsInTypeCasts() { doTest5(false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user