1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 8230082 4 * @summary Javac should not allow inline type's fields to be volatile (as they are final) 5 * @compile/fail/ref=NoVolatileFields.out -XDrawDiagnostics NoVolatileFields.java 6 */ 7 8 public class NoVolatileFields { 9 10 static class Foo { 11 volatile final int i = 0; // Error 12 } 13 14 static primitive class Bar { 15 volatile int i = 0; // Error 16 } 17 } 18