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
The following code compiles fine, but throws an NPE when run:
record Record(Byte b) {}
public class X {
public static void main(String argv[]) {
X x = new X();
System.out.println(x.foo(new Record(null)));
}
public int foo(Record r) {
int result = 0;
result = r instanceof Record(short s) ? 0 : 1;
return result;
}
}
Inspecting the produced output, I find this strange lines which is causing the issue:
10: checkcast #23 // class Record
13: invokevirtual #41 // Method Record.i:()Ljava/lang/Byte;
16: invokevirtual #45 // Method java/lang/Byte.byteValue:()B
The text was updated successfully, but these errors were encountered:
The following code compiles fine, but throws an NPE when run:
Inspecting the produced output, I find this strange lines which is causing the issue:
The text was updated successfully, but these errors were encountered: