[java] IJ-CR-167924 IDEA-371865 Inspection to convert 'System.out'<->'IO'

- add array case

(cherry picked from commit fb6b84584ef3778f9b03216d3df57bfea1433b84)


(cherry picked from commit 75d20e2763b7b7506ccab939805cd9d18aa3d745)

IJ-MR-169535

GitOrigin-RevId: 8268a8491f2be9eedca68f0d75f71ac61e6f7795
This commit is contained in:
Mikhail Pyltsin
2025-07-10 10:53:17 +02:00
committed by intellij-monorepo-bot
parent d3b08c4011
commit 3e2d137fdf
2 changed files with 52 additions and 1 deletions

View File

@@ -319,6 +319,8 @@ public interface CallMatcher extends Predicate<PsiMethodCallExpression> {
* The resulting matcher enforces the following criteria for unresolved calls:
* - Method name must match the specified names.
* - The argument list must match certain conditions based on parameter types.
* - Checking types is limited and checks only basic cases. Generics, primitive conversions, and so on are not supported and should be checked separately.
* - Class name must match the specified class name.
* - Class name must end with qualifier expressions. Qualifier expression should be unresolved.
* - Call is checked as it is static.
* <p>
@@ -445,7 +447,10 @@ public interface CallMatcher extends Predicate<PsiMethodCallExpression> {
else {
parameter = myParameters[myParameters.length - 1];
}
if (!expressionTypeMatches(parameter, arg)) return false;
if (!(expressionTypeMatches(parameter, arg) ||
(myParameters.length - 1 == i && args.length == myParameters.length &&
parameter.endsWith("...") &&
expressionTypeMatches(parameter.substring(0, parameter.length() - 3) + "[]", arg)))) return false;
}
return true;
}