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

Print this page

        

*** 2,17 **** * @test /nodynamiccopyright/ * @summary Value types may not declare fields of its own type either directly or indirectly. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckCyclicMembership.out -XDrawDiagnostics -Werror -Xlint:values CheckCyclicMembership.java */ ! @jvm.internal.value.DeriveValueType final class CheckCyclicMembership { class InnerRef { CheckCyclicMembership ccm; } ! @jvm.internal.value.DeriveValueType final class InnerValue { final CheckCyclicMembership ccm = new CheckCyclicMembership(); // Error. } final CheckCyclicMembership ccm = new CheckCyclicMembership(); // Error. final int i = 10; final String s = "blah"; --- 2,17 ---- * @test /nodynamiccopyright/ * @summary Value types may not declare fields of its own type either directly or indirectly. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckCyclicMembership.out -XDrawDiagnostics -Werror -Xlint:values CheckCyclicMembership.java */ ! @jvm.internal.value.ValueCapableClass final class CheckCyclicMembership { class InnerRef { CheckCyclicMembership ccm; } ! @jvm.internal.value.ValueCapableClass final class InnerValue { final CheckCyclicMembership ccm = new CheckCyclicMembership(); // Error. } final CheckCyclicMembership ccm = new CheckCyclicMembership(); // Error. final int i = 10; final String s = "blah";