test/tools/javac/valhalla/minimalvalues/CheckNullCastable.java

Print this page

        

*** 2,12 **** * @test /nodynamiccopyright/ * @summary null cannot be casted to and compared with value types. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckNullCastable.out -XDrawDiagnostics -Werror -Xlint:values CheckNullCastable.java */ ! @jvm.internal.value.DeriveValueType final class CheckNullCastable { void foo(CheckNullCastable cnc) { CheckNullCastable cncl = (CheckNullCastable) null; if (cnc != null) {}; if (null != cnc) {}; --- 2,12 ---- * @test /nodynamiccopyright/ * @summary null cannot be casted to and compared with value types. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckNullCastable.out -XDrawDiagnostics -Werror -Xlint:values CheckNullCastable.java */ ! @jvm.internal.value.ValueCapableClass final class CheckNullCastable { void foo(CheckNullCastable cnc) { CheckNullCastable cncl = (CheckNullCastable) null; if (cnc != null) {}; if (null != cnc) {};