1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary May not synchronize on value types
   4  * @modules jdk.incubator.mvt
   5  * @compile/fail/ref=CheckSync.out -XDrawDiagnostics -Werror -Xlint:values  CheckSync.java
   6  */
   7 
   8 /* Note: ATM, value types do not have jlO in their lineage. So they anyway
   9    cannot synchronize using the methods declared on jlO.
  10 */
  11 @jdk.incubator.mvt.ValueCapableClass
  12 public final class CheckSync {
  13     @jdk.incubator.mvt.ValueCapableClass
  14     final class Val {
  15 
  16         void foo() {
  17             // All calls below are bad.
  18             wait();
  19             wait(10);
  20             wait(10, 10);
  21             notify();
  22             notifyAll();
  23             finalize();
  24             clone();
  25         }
  26     }
  27 
  28     final Val val = new Val();
  29 
  30     void test() throws InterruptedException {
  31         // All calls below are bad.
  32         val.wait();
  33         val.wait(10);
  34         val.wait(new Integer(10));
  35         val.wait(new Long(10));
  36         val.wait(10L);
  37         val.wait(10L, 10);
  38         val.wait("Hello");
  39         val.notify();
  40         val.notifyAll();
  41     }
  42 }