From 793c7a0a3a0c2d8650bcdd241627fd77a4deaf46 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 26 Jul 2012 18:14:06 +0200 Subject: [PATCH] EA-37682 - NPE: ChangeTypeArgumentsFix.fun --- .../daemon/impl/quickfix/ChangeTypeArgumentsFix.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeTypeArgumentsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeTypeArgumentsFix.java index 8fc1cda79e44..bb216bfe6b65 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeTypeArgumentsFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeTypeArgumentsFix.java @@ -63,7 +63,8 @@ public class ChangeTypeArgumentsFix implements IntentionAction, HighPriorityActi return "Change type arguments to <" + StringUtil.join(myPsiClass.getTypeParameters(), new Function() { @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; } }