1 /*
   2  * @test /nodynamiccopyright/
   3  * @summary check that the compiler doesn't accept incorrect accessors
   4  * @compile/fail/ref=BadAccessorsTest.out -XDrawDiagnostics BadAccessorsTest.java
   5  */
   6 
   7 import java.util.List;
   8 
   9 public class BadAccessorsTest {
  10     record R1(int i, int j, int k, List<String> ls) {
  11         // accessors has to be public
  12         int i() { return i; }
  13         private int j() { return j; }
  14         protected int k() { return k; }
  15         // must match type exactly
  16         public List ls() { return ls; }
  17     }
  18 }