From c6a39d0f937bf64f3e109edd0aea7ca4995c8d10 Mon Sep 17 00:00:00 2001 From: "Maxim.Medvedev" Date: Thu, 6 Sep 2012 12:22:54 +0400 Subject: [PATCH] EA-37375 - NPE: DynamicMethodFix.getText --- .../plugins/groovy/lang/psi/util/PsiUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java index 5f8352025d66..8f2c81ed7803 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java @@ -235,13 +235,14 @@ public class PsiUtil { public static PsiType[] getArgumentTypes(PsiElement place, boolean nullAsBottom) { return getArgumentTypes(place, nullAsBottom, null, false); } + @Nullable public static PsiType[] getArgumentTypes(PsiElement place, boolean nullAsBottom, @Nullable GrExpression stopAt, boolean byShape) { PsiElement parent = place instanceof GrEnumConstant ? place : place.getParent(); if (parent instanceof GrIndexProperty) { GrIndexProperty index = (GrIndexProperty)parent; - PsiType[] argTypes = getArgumentTypes(index.getNamedArguments(), index.getExpressionArguments(), index.getClosureArguments(), false, null, byShape); + PsiType[] argTypes = getArgumentTypes(index.getNamedArguments(), index.getExpressionArguments(), index.getClosureArguments(), nullAsBottom, stopAt, byShape); if (isLValue(index) && argTypes != null) { return ArrayUtil.append(argTypes, TypeInferenceHelper.getInitializerFor(index)); } @@ -260,10 +261,10 @@ public class PsiUtil { else if (parent instanceof GrAnonymousClassDefinition) { final GrArgumentList argList = ((GrAnonymousClassDefinition)parent).getArgumentListGroovy(); if (argList == null) { - return getArgumentTypes(GrNamedArgument.EMPTY_ARRAY, GrExpression.EMPTY_ARRAY, GrClosableBlock.EMPTY_ARRAY, false, null, byShape); + return getArgumentTypes(GrNamedArgument.EMPTY_ARRAY, GrExpression.EMPTY_ARRAY, GrClosableBlock.EMPTY_ARRAY, nullAsBottom, stopAt, byShape); } else { - return getArgumentTypes(argList.getNamedArguments(), argList.getExpressionArguments(), GrClosableBlock.EMPTY_ARRAY, false, null, byShape); + return getArgumentTypes(argList.getNamedArguments(), argList.getExpressionArguments(), GrClosableBlock.EMPTY_ARRAY, nullAsBottom, stopAt, byShape); } } @@ -280,7 +281,8 @@ public class PsiUtil { GrExpression[] expressions, GrClosableBlock[] closures, boolean nullAsBottom, - @Nullable GrExpression stopAt, boolean byShape) { + @Nullable GrExpression stopAt, + boolean byShape) { List result = new ArrayList(); if (namedArgs.length > 0) {