strip wildcards when prepare explicit generics types to qualify the method calls (IDEA-106741)

This commit is contained in:
anna
2013-05-06 19:25:40 +02:00
parent 5668131329
commit f8509e1d67
3 changed files with 37 additions and 1 deletions
@@ -71,7 +71,7 @@ public class AddTypeArgumentsFix extends MethodArgumentFix {
PsiTypeParameter typeParameter = typeParameters[i];
final PsiType substitution = helper.getSubstitutionForTypeParameter(typeParameter, returnType, toType, false, level);
if (substitution == null || PsiType.NULL.equals(substitution)) return null;
mappings[i] = substitution;
mappings[i] = GenericsUtil.eliminateWildcards(substitution);
}
final PsiElementFactory factory = JavaPsiFacade.getInstance(expression.getProject()).getElementFactory();
@@ -0,0 +1,18 @@
// "Add explicit type arguments" "true"
class X<A1, A2, R> { }
class D<R> {
public <A1, A2> X<A1, A2, R> f() {
return null;
}
}
class Z {
public void f() {
g(new D<Void>().<String, Integer>f());
}
public void g(X<String, ? super Integer, Void> x) {
}
}
@@ -0,0 +1,18 @@
// "Add explicit type arguments" "true"
class X<A1, A2, R> { }
class D<R> {
public <A1, A2> X<A1, A2, R> f() {
return null;
}
}
class Z {
public void f() {
g(new D<Void>().<caret>f());
}
public void g(X<String, ? super Integer, Void> x) {
}
}