CCE
authoranna <Anna.Kozlova@jetbrains.com>
Thu, 15 Jul 2010 08:42:03 +0000 (12:42 +0400)
committeranna <Anna.Kozlova@jetbrains.com>
Thu, 15 Jul 2010 08:42:42 +0000 (12:42 +0400)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapExpressionFix.java

index 177a0c70a9b83ae3d0e0482c056c0cbd52b56c95..d4c85df105fb651e4d3590e5fb11808c5acc9c4d 100644 (file)
@@ -45,8 +45,13 @@ public class WrapExpressionFix implements IntentionAction {
 
   @Nullable
   private static PsiClassType getClassType(PsiType type, PsiElement place) {
-    return (PsiClassType)(type instanceof PsiClassType ?
-                          type : ((PsiPrimitiveType)type).getBoxedType(place.getManager(), GlobalSearchScope.allScope(place.getProject())));
+    if (type instanceof PsiClassType) {
+      return (PsiClassType)type;
+    }
+    else if (type instanceof PsiPrimitiveType){
+      return ((PsiPrimitiveType)type).getBoxedType(place.getManager(), GlobalSearchScope.allScope(place.getProject()));
+    }
+    return null;
   }
 
   @NotNull
@@ -134,9 +139,8 @@ public class WrapExpressionFix implements IntentionAction {
           }
           paramType = substitutor != null ? substitutor.substitute(paramType) : paramType;
           if (paramType.isAssignableFrom(exprType)) continue;
-          if (expectedType == null && findWrapper(exprType,
-                                                  getClassType(paramType, expression),
-                                                  paramType instanceof PsiPrimitiveType) != null) {
+          final PsiClassType classType = getClassType(paramType, expression);
+          if (expectedType == null && classType != null && findWrapper(exprType, classType, paramType instanceof PsiPrimitiveType) != null) {
             expectedType = paramType;
             expr = expression;
           } else {