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

Print this page

        

*** 2,12 **** * @test /nodynamiccopyright/ * @summary Assignment of null to value types should be disallowed. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckNullAssign.out -XDrawDiagnostics -Werror -Xlint:values CheckNullAssign.java */ ! @jvm.internal.value.DeriveValueType final class CheckNullAssign { CheckNullAssign foo(CheckNullAssign cna) { // All of the below involve subtype/assignability checks and should be rejected. CheckNullAssign cnal = null; cna = null; --- 2,12 ---- * @test /nodynamiccopyright/ * @summary Assignment of null to value types should be disallowed. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckNullAssign.out -XDrawDiagnostics -Werror -Xlint:values CheckNullAssign.java */ ! @jvm.internal.value.ValueCapableClass final class CheckNullAssign { CheckNullAssign foo(CheckNullAssign cna) { // All of the below involve subtype/assignability checks and should be rejected. CheckNullAssign cnal = null; cna = null;