1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/NonStaticFieldExpr3.java Wed Apr 27 01:34:52 2016 +0800 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 + @compile/fail/ref=NonStaticFieldExpr3.out -XDrawDiagnostics NonStaticFieldExpr3.java 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 +}