test/langtools/tools/javac/NonStaticFieldExpr2.java
author dmarkov
Mon, 23 Sep 2019 17:18:03 +0100
changeset 58328 fe46ee1d42ee
parent 47216 71c04702a3d5
permissions -rw-r--r--
8230782: Robot.createScreenCapture() fails if “awt.robot.gtk” is set to false Reviewed-by: prr, serb

/* @test  /nodynamiccopyright/
   @bug 4087127 4785453
   @author dps
   @summary method: instance access through types is not allowed

   @compile/fail/ref=NonStaticFieldExpr2.out -XDrawDiagnostics NonStaticFieldExpr2.java
*/

class NonStaticFieldExpr2 {

  public int x;

  void foo () {
     int z = NonStaticFieldExpr2.x;     // SHOULD BE ERROR
  }
}