mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-112173 Smart completion after 'new' should honor upper bound of generic parameters
This commit is contained in:
@@ -448,7 +448,7 @@ public class GenericsUtil {
|
||||
PsiType substituted = resolveResult.getSubstitutor().substitute(typeParam);
|
||||
if (substituted instanceof PsiWildcardType) {
|
||||
substituted = ((PsiWildcardType)substituted).getBound();
|
||||
if (substituted == null) substituted = PsiType.getJavaLangObject(manager, aClass.getResolveScope());
|
||||
if (substituted == null) substituted = TypeConversionUtil.typeParameterErasure(typeParam);
|
||||
}
|
||||
map.put(typeParam, substituted);
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A<X extends Throwable> {}
|
||||
class B {
|
||||
{
|
||||
m(new A<Throwable>());<caret>
|
||||
}
|
||||
void m(A<?> a) { }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A<X extends Throwable> {}
|
||||
class B {
|
||||
{
|
||||
m(new <caret>)
|
||||
}
|
||||
void m(A<?> a) { }
|
||||
}
|
||||
+2
@@ -627,6 +627,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
public void testDefaultAnnoParam() throws Throwable { doTest(); }
|
||||
|
||||
public void testCastGenericQualifier() throws Throwable { doTest(); }
|
||||
|
||||
public void testNewWithTypeParameterErasure() throws Throwable { doTest(); }
|
||||
|
||||
public void testEverythingDoubles() throws Throwable {
|
||||
configureByTestName();
|
||||
|
||||
Reference in New Issue
Block a user