1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary Value types and their instance fields must be final
   4  * @modules java.base/jvm.internal.value
   5  * @compile/fail/ref=CheckFinal.out -XDrawDiagnostics -Werror -Xlint:values CheckFinal.java
   6  */
   7 
   8 @jvm.internal.value.DeriveValueType
   9 class CheckFinal {  // <- error
  10     int x;          // <- error
  11     void f(int x) { // <- ok
  12         int y;      // <- ok
  13         @jvm.internal.value.DeriveValueType
  14         final class CheckLocalFinal {
  15             int x; // <- error.
  16         }
  17     }
  18     final Object o = new Object() { int i; }; // <- ok
  19     static int xs; // OK.
  20 }