IG: highlight constructor call problems too (IDEA-173852)

This commit is contained in:
Bas Leijdekkers
2017-06-04 13:11:41 +02:00
parent 674b80a1a2
commit 47876aaed3
2 changed files with 13 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2016 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2017 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,9 +83,12 @@ public class NullArgumentToVariableArgMethodInspection extends BaseInspection {
private static class NullArgumentToVariableArgVisitor extends BaseInspectionVisitor {
@Override
public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
super.visitMethodCallExpression(call);
public void visitCallExpression(PsiCallExpression call) {
super.visitCallExpression(call);
final PsiExpressionList argumentList = call.getArgumentList();
if (argumentList == null) {
return;
}
final PsiExpression[] arguments = argumentList.getExpressions();
if (arguments.length == 0) {
return;
@@ -25,4 +25,11 @@ class X {
public static String join(CharSequence delimiter, CharSequence... elements) {
return "";
}
}
class AB {
AB(String msg, Object... args) {}
void m(String e) {
new AB("reactor", <warning descr="Confusing argument 'null', unclear if a varargs or non-varargs call is desired">null</warning>);
}
}