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

Print this page

        

*** 3,18 **** * @summary Value types and their instance fields must be final * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckFinal.out -XDrawDiagnostics -Werror -Xlint:values CheckFinal.java */ ! @jvm.internal.value.DeriveValueType class CheckFinal { // <- error int x; // <- error void f(int x) { // <- ok int y; // <- ok ! @jvm.internal.value.DeriveValueType final class CheckLocalFinal { int x; // <- error. } } final Object o = new Object() { int i; }; // <- ok --- 3,18 ---- * @summary Value types and their instance fields must be final * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckFinal.out -XDrawDiagnostics -Werror -Xlint:values CheckFinal.java */ ! @jvm.internal.value.ValueCapableClass class CheckFinal { // <- error int x; // <- error void f(int x) { // <- ok int y; // <- ok ! @jvm.internal.value.ValueCapableClass final class CheckLocalFinal { int x; // <- error. } } final Object o = new Object() { int i; }; // <- ok