IDEA often highlights all arguments of a method call complaining a method with the proper signature cannot be found, when in fact there is only a problem with one of the arguments. This problem can then be hard to spot. For example consider the following code. The char array "chars" is not defined and all arguments of String.valueOf() are highlighted with the warning "valueOf(char[], int, int) in String cannot be applied to (null, int, int)". Note that in the case of a "new" expression IDEA does the right thing and only highlights the "chars" argument.
class A {{
String.valueOf(chars, 0, 10); // all arguments are highlighted when only chars has a problem
newString(chars, 0, 10); // highlighting is good here.
}}
Description
IDEA often highlights all arguments of a method call complaining a method with the proper signature cannot be found, when in fact there is only a problem with one of the arguments. This problem can then be hard to spot. For example consider the following code. The char array "chars" is not defined and all arguments of String.valueOf() are highlighted with the warning "valueOf(char[], int, int) in String cannot be applied to (null, int, int)". Note that in the case of a "new" expression IDEA does the right thing and only highlights the "chars" argument.
class A {{
String.valueOf(chars, 0, 10); // all arguments are highlighted when only chars has a problem
newString(chars, 0, 10); // highlighting is good here.
}}