mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
normalize array of captures type (IDEA-211139)
GitOrigin-RevId: bfb2392bd4cd5e435ad6a3e8a825b068e17fb5fc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
305fba4b65
commit
8e2bf508e0
@@ -307,8 +307,10 @@ public class GenericsUtil {
|
||||
if (refClass instanceof PsiAnonymousClass) {
|
||||
type = ((PsiAnonymousClass)refClass).getBaseClassType();
|
||||
}
|
||||
if (type instanceof PsiCapturedWildcardType) {
|
||||
type = ((PsiCapturedWildcardType)type).getUpperBound();
|
||||
PsiType deepComponentType = type.getDeepComponentType();
|
||||
if (deepComponentType instanceof PsiCapturedWildcardType) {
|
||||
type = PsiTypesUtil.createArrayType(((PsiCapturedWildcardType)deepComponentType).getUpperBound(),
|
||||
type.getArrayDimensions());
|
||||
}
|
||||
PsiType transformed = type.accept(new PsiTypeVisitor<PsiType>() {
|
||||
@Override
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface I {}
|
||||
|
||||
abstract class Test<T extends I> {
|
||||
void foo(Test<?> t) {
|
||||
I[] m = t.get();
|
||||
}
|
||||
|
||||
abstract T[] get();
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface I {}
|
||||
|
||||
abstract class Test<T extends I> {
|
||||
void foo(Test<?> t) {
|
||||
<selection>t.get()</selection>
|
||||
}
|
||||
|
||||
abstract T[] get();
|
||||
}
|
||||
@@ -670,6 +670,10 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
public void testCapturedWildcardUpperBoundSuggestedAsType() {
|
||||
doTest(new MockIntroduceVariableHandler("m", false, false, false, "I"));
|
||||
}
|
||||
|
||||
public void testArrayOfCapturedWildcardUpperBoundSuggestedAsType() {
|
||||
doTest(new MockIntroduceVariableHandler("m", false, false, false, "I[]"));
|
||||
}
|
||||
|
||||
public void testReturnNonExportedArray() {
|
||||
doTest(new MockIntroduceVariableHandler("i", false, false, false, "java.io.File[]") {
|
||||
|
||||
Reference in New Issue
Block a user