From 0bc7001871120f860538b1051713782889879861 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 17 Jul 2009 14:01:32 +0400 Subject: [PATCH] Check if array is passed as a parameter --- .../codeInspection/i18n/InvalidPropertyKeyInspection.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java index 0282738167..c620ca4c38 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java @@ -179,7 +179,8 @@ public class InvalidPropertyKeyInspection extends BaseJavaLocalInspectionTool { if (i + paramsCount >= args.length && method != null && method.getParameterList().getParametersCount() == i+2 - && method.getParameterList().getParameters()[i+1].isVarArgs()) { + && method.getParameterList().getParameters()[i+1].isVarArgs() + && !hasArrayTypeAt(i+1, methodCall)) { myProblems.add(myManager.createProblemDescriptor(methodCall, CodeInsightBundle.message("property.has.more.parameters.than.passed", key, paramsCount, args.length-i-1), new LocalQuickFix[0], @@ -191,6 +192,12 @@ public class InvalidPropertyKeyInspection extends BaseJavaLocalInspectionTool { } } + private boolean hasArrayTypeAt(int i, PsiMethodCallExpression methodCall) { + return methodCall != null + && methodCall.getArgumentList().getExpressionTypes().length > i + && methodCall.getArgumentList().getExpressionTypes()[i] instanceof PsiArrayType; + } + private static boolean isComputablePropertyExpression(PsiExpression expression) { while (expression != null && expression.getParent() instanceof PsiParenthesizedExpression) expression = (PsiExpression)expression.getParent(); return expression != null && expression.getParent() instanceof PsiExpression; -- 2.11.4.GIT