You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Test {
void test(Object obj) {
if (obj instanceof String _) {
_.equals("s"); // compile time error, Using '_' as a reference is not allowed
}
}
}
we can't call equals() on unnamed variables or patterns so this check is not applicable to them.
child of #14942
I have read check documentation: https://checkstyle.org/checks/coding/equalsavoidnull.html#EqualsAvoidNull
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
we can't call
equals()on unnamed variables or patterns so this check is not applicable to them.