1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary null cannot be casted to and compared with value types.
   4  * @modules  java.base/jvm.internal.value
   5  * @compile/fail/ref=CheckNullCastable.out -XDrawDiagnostics -Werror  -Xlint:values  CheckNullCastable.java
   6  */
   7 @jvm.internal.value.ValueCapableClass
   8 final class CheckNullCastable {
   9     void foo(CheckNullCastable cnc) {
  10         CheckNullCastable cncl = (CheckNullCastable) null;
  11         if (cnc != null) {};
  12         if (null != cnc) {};
  13     }
  14 }