IDEA-112173 Smart completion after 'new' should honor upper bound of generic parameters

This commit is contained in:
peter
2013-08-30 21:44:33 +02:00
parent aff844a25a
commit fa68185dd2
4 changed files with 17 additions and 1 deletions
@@ -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);
}
@@ -0,0 +1,7 @@
class A<X extends Throwable> {}
class B {
{
m(new A<Throwable>());<caret>
}
void m(A<?> a) { }
}
@@ -0,0 +1,7 @@
class A<X extends Throwable> {}
class B {
{
m(new <caret>)
}
void m(A<?> a) { }
}
@@ -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();