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

Print this page

        

*** 2,12 **** * @test /nodynamiccopyright/ * @summary Check behavior of synzhronized key word on value instances and methods. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckSynchronized.out -XDrawDiagnostics -Werror -Xlint:values CheckSynchronized.java */ ! @jvm.internal.value.DeriveValueType final class CheckSynchronized { synchronized void foo() { // <<-- ERROR, no monitor associated with `this' } void goo() { synchronized(this) {} // <<-- ERROR, no monitor associated with `this' --- 2,12 ---- * @test /nodynamiccopyright/ * @summary Check behavior of synzhronized key word on value instances and methods. * @modules java.base/jvm.internal.value * @compile/fail/ref=CheckSynchronized.out -XDrawDiagnostics -Werror -Xlint:values CheckSynchronized.java */ ! @jvm.internal.value.ValueCapableClass final class CheckSynchronized { synchronized void foo() { // <<-- ERROR, no monitor associated with `this' } void goo() { synchronized(this) {} // <<-- ERROR, no monitor associated with `this'