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
interface I {
}
final class A implements I {
}
final class B implements I {
}
record R(I x, I y) {
}
public class X {
public static boolean foo(R r) {
if (r instanceof R(A a1, A a2)) // wrong warning here: The expression of type R is already an instance of type R
return true;
return false;
}
public static void main(String argv[]) {
System.out.println(X.foo(new R(new A(), new A())));
System.out.println(X.foo(new R(new A(), new B())));
}
}
The text was updated successfully, but these errors were encountered:
srikanth-sankaran
changed the title
[Patterns][records] Wrong warning "The expression of type R is already an instance of type R" with deconstruction patterns
[Patterns][records] Instanceof with record deconstruction patterns should never be flagged as unnecessary
Feb 16, 2024
The text was updated successfully, but these errors were encountered: