mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
open capture reverted
This commit is contained in:
@@ -235,6 +235,11 @@ public class GenericsUtil {
|
||||
|
||||
@Nullable
|
||||
public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type) {
|
||||
return getVariableTypeByExpressionType(type, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type, final boolean openCaptured) {
|
||||
if (type == null) return null;
|
||||
if (type instanceof PsiCapturedWildcardType) {
|
||||
type = ((PsiCapturedWildcardType)type).getWildcard();
|
||||
@@ -274,7 +279,7 @@ public class GenericsUtil {
|
||||
|
||||
@Override
|
||||
public PsiType visitCapturedWildcardType(PsiCapturedWildcardType capturedWildcardType) {
|
||||
return capturedWildcardType;
|
||||
return openCaptured ? capturedWildcardType.getWildcard().accept(this) : capturedWildcardType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class PsiArrayAccessExpressionImpl extends ExpressionPsiElement implement
|
||||
public PsiType getType() {
|
||||
PsiType arrayType = getArrayExpression().getType();
|
||||
if (!(arrayType instanceof PsiArrayType)) return null;
|
||||
return GenericsUtil.getVariableTypeByExpressionType(((PsiArrayType)arrayType).getComponentType());
|
||||
return GenericsUtil.getVariableTypeByExpressionType(((PsiArrayType)arrayType).getComponentType(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -177,7 +177,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testSCR40281() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("temp", false, false, false, "Set<? extends Map<?,java.lang.String>.Entry<capture<?>,java.lang.String>>"));
|
||||
doTest(new MockIntroduceVariableHandler("temp", false, false, false, "Set<? extends Map<?,java.lang.String>.Entry<?,java.lang.String>>"));
|
||||
}
|
||||
|
||||
public void testWithIfBranches() throws Exception {
|
||||
@@ -189,7 +189,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testDuplicateGenericExpressions() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("temp", true, false, false, "Foo2<capture<? extends java.lang.Runnable>>"));
|
||||
doTest(new MockIntroduceVariableHandler("temp", true, false, false, "Foo2<? extends java.lang.Runnable>"));
|
||||
}
|
||||
|
||||
public void testStaticImport() throws Exception {
|
||||
@@ -308,7 +308,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testAssignmentToUnresolvedReference() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("collection", true, true, true, "java.util.List<? extends java.util.Collection<capture<?>>>"));
|
||||
doTest(new MockIntroduceVariableHandler("collection", true, true, true, "java.util.List<? extends java.util.Collection<?>>"));
|
||||
}
|
||||
|
||||
public void testNameSuggestion() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user