1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary Check behavior of synzhronized key word on value instances and methods.
   4  * @modules  java.base/jvm.internal.value
   5  * @compile/fail/ref=CheckSynchronized.out -XDrawDiagnostics -Werror -Xlint:values  CheckSynchronized.java
   6  */
   7 @jvm.internal.value.DeriveValueType
   8 final class CheckSynchronized {
   9     synchronized void foo() { // <<-- ERROR, no monitor associated with `this'
  10     }
  11     void goo() {
  12         synchronized(this) {} // <<-- ERROR, no monitor associated with `this'
  13     }
  14     synchronized static void zoo(CheckSynchronized cs) { // OK, static method.
  15         synchronized(cs) {    // <<-- ERROR, no monitor associated with value instance.
  16         }
  17     }
  18 }