test/tools/javac/NonStaticFieldExpr3.java

changeset 1
9a66ca7c79fa
child 69
82c7aa6fe50a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/NonStaticFieldExpr3.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,15 @@
     1.4 +/* @test  /nodynamiccopyright/
     1.5 +   @bug 4087127 4785453
     1.6 +   @author dps
     1.7 +   @summary class: instance access through types is not allowed
     1.8 +
     1.9 +   @run shell NonStaticFieldExpr3.sh
    1.10 +*/
    1.11 +
    1.12 +class NonStaticFieldExpr3 {
    1.13 +  public int x;
    1.14 +}
    1.15 +
    1.16 +class Subclass extends NonStaticFieldExpr3 {
    1.17 +  int a = NonStaticFieldExpr3.x;      // SHOULD BE ERROR
    1.18 +}

mercurial