Thu, 07 Jun 2012 20:30:57 -0700
7170079: Adjustments to build-infra makefiles
Reviewed-by: ohair, ohrstrom, ihse, jonas
Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
duke@1 | 1 | /** |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 4094658 4277300 4785453 |
duke@1 | 4 | * @summary Test enforcement of JLS 6.6.1 and 6.6.2 rules requiring that |
duke@1 | 5 | * the type to which a component member belongs be accessible in qualified |
duke@1 | 6 | * names. |
duke@1 | 7 | * |
jjg@69 | 8 | * @compile pack1/P1.java |
jjg@69 | 9 | * @compile pack1/P2.java |
jjg@611 | 10 | * @compile/fail/ref=QualifiedAccess_2.out -XDrawDiagnostics QualifiedAccess_2.java |
duke@1 | 11 | */ |
duke@1 | 12 | |
duke@1 | 13 | import pack1.P1; |
duke@1 | 14 | |
duke@1 | 15 | class A { |
duke@1 | 16 | private static class B { |
duke@1 | 17 | static class Inner {} |
duke@1 | 18 | } |
duke@1 | 19 | } |
duke@1 | 20 | |
duke@1 | 21 | class X extends pack1.P1 { |
duke@1 | 22 | X() { super("bar"); } |
duke@1 | 23 | void foo() { |
duke@1 | 24 | /*-----------------* |
duke@1 | 25 | // BOGUS: Reports matching constructor not found. |
duke@1 | 26 | // OK if 'Q' is made a public constructor. |
duke@1 | 27 | Object y = new Q("foo");// ERROR - protected constructor Q inaccessible |
duke@1 | 28 | *------------------*/ |
duke@1 | 29 | // Reports 'P1.R.S' not found at all. (private) |
duke@1 | 30 | Object z = new R.S.T(); // ERROR - S is inaccessible |
duke@1 | 31 | } |
duke@1 | 32 | } |
duke@1 | 33 | |
duke@1 | 34 | class Y { |
duke@1 | 35 | |
duke@1 | 36 | class Foo { |
duke@1 | 37 | class Bar {} |
duke@1 | 38 | } |
duke@1 | 39 | |
duke@1 | 40 | class C extends A.B {} // ERROR - B is inaccessible |
duke@1 | 41 | class D extends A.B.Inner {} // ERROR - B is inaccessible |
duke@1 | 42 | |
duke@1 | 43 | static class Quux { |
duke@1 | 44 | private static class Quem { |
duke@1 | 45 | P1.Foo.Bar x; // ERROR - Foo is inaccessible |
duke@1 | 46 | static class MyError extends Error {} |
duke@1 | 47 | } |
duke@1 | 48 | } |
duke@1 | 49 | } |
duke@1 | 50 | |
duke@1 | 51 | class Z { |
duke@1 | 52 | void foo() throws Y.Quux.Quem.MyError { |
duke@1 | 53 | // ERROR - type of Quux not accesible (private) |
duke@1 | 54 | throw new Y.Quux.Quem.MyError(); |
duke@1 | 55 | // ERROR - type of Quux not accesible (private) |
duke@1 | 56 | } |
duke@1 | 57 | } |