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

Print this page

        

*** 2,17 **** * @test /nodynamiccopyright/ * @summary Value types do not support finalize * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckFinalize.out -XDrawDiagnostics -Werror -Xlint:values CheckFinalize.java */ ! @jvm.internal.value.DeriveValueType final class CheckFinalize { @Override protected void finalize() {} // <-- error ! @jvm.internal.value.DeriveValueType final class CheckFinalizeInner {} void foo(CheckFinalizeInner cfi, CheckFinalize cf) { cfi.finalize(); // Error cf.finalize(); // OK. --- 2,17 ---- * @test /nodynamiccopyright/ * @summary Value types do not support finalize * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckFinalize.out -XDrawDiagnostics -Werror -Xlint:values CheckFinalize.java */ ! @jvm.internal.value.ValueCapableClass final class CheckFinalize { @Override protected void finalize() {} // <-- error ! @jvm.internal.value.ValueCapableClass final class CheckFinalizeInner {} void foo(CheckFinalizeInner cfi, CheckFinalize cf) { cfi.finalize(); // Error cf.finalize(); // OK.