EA-37682 - NPE: ChangeTypeArgumentsFix.fun

This commit is contained in:
anna
2012-07-26 18:21:16 +02:00
parent 51165c80da
commit 793c7a0a3a
@@ -63,7 +63,8 @@ public class ChangeTypeArgumentsFix implements IntentionAction, HighPriorityActi
return "Change type arguments to <" + StringUtil.join(myPsiClass.getTypeParameters(), new Function<PsiTypeParameter, String>() {
@Override
public String fun(PsiTypeParameter typeParameter) {
return substitutor.substitute(typeParameter).getPresentableText();
final PsiType substituted = substitutor.substitute(typeParameter);
return substituted != null ? substituted.getPresentableText() : CommonClassNames.JAVA_LANG_OBJECT;
}
}, ", ") + ">";
}
@@ -94,6 +95,9 @@ public class ChangeTypeArgumentsFix implements IntentionAction, HighPriorityActi
final PsiType actualType = myExpressions[i].getType();
if (expectedType == null || actualType == null || !TypeConversionUtil.isAssignable(expectedType, actualType)) return false;
}
for (PsiTypeParameter parameter : typeParameters) {
if (substitutor.substitute(parameter) == null) return false;
}
return true;
}
}