0N/A/**
0N/A * @test /nodynamiccopyright/
0N/A * @bug 4094658 4785453
0N/A * @summary Test enforcement of JLS 6.6.1 and 6.6.2 rules requiring that
0N/A * the type to which a component member belongs be accessible in qualified
0N/A * names.
0N/A *
610N/A * @compile/fail/ref=QualifiedAccess_3.out -XDrawDiagnostics QualifiedAccess_3.java
0N/A */
0N/A
0N/Aimport pack1.P1;
0N/A
0N/Aclass CMain {
0N/A
0N/A class Foo {
0N/A class Bar {}
0N/A }
0N/A
0N/A static class Baz {
0N/A private static class Quux {
0N/A static class Quem {}
0N/A }
0N/A }
0N/A
0N/A // These are all OK.
0N/A CMain z = new CMain();
0N/A Foo x = z.new Foo();
0N/A Foo.Bar y = x.new Bar();
0N/A
0N/A void test() {
0N/A P1 p1 = new P1();
0N/A
0N/A // These are NOT errors, and should NOT be detected, as observed.
0N/A /*------------------------------------*
0N/A Baz.Quux z = null;
0N/A Baz.Quux.Quem y = null;
0N/A *------------------------------------*/
0N/A
0N/A P1.Foo.Bar x = null; // ERROR - 'P1.Foo' not accessible
0N/A int i = p1.a.length; // ERROR - Type of 'a' not accessible
0N/A // The type of the expression from which a component
0N/A // is selected must be accessible.
0N/A p1.p2.privatei = 3; // ERROR - Type of 'p1.p2' not accessible.
0N/A System.out.println (p1.p2.privatei); // ERROR - Type of 'p1.p2' not accessible.
0N/A }
0N/A
0N/A}