Mon, 17 Oct 2011 12:57:36 +0100
7093325: Redundant entry in bytecode exception table
Summary: Inlining of finalizers does not update gaps list accordingly
Reviewed-by: jjg
1 /**
2 * @test /nodynamiccopyright/
3 * @bug 4094658 4277296 4785453
4 * @summary Test enforcement of JLS 6.6.1 and 6.6.2 rules requiring that
5 * the type to which a component member belongs be accessible in qualified
6 * names.
7 *
8 * @compile pack1/P1.java
9 * @compile pack1/P2.java
10 * @compile/fail/ref=QualifiedAccess_1.out -XDrawDiagnostics QualifiedAccess_1.java
11 */
13 import pack1.P1;
15 public class QualifiedAccess_1 {
17 // Inaccessible types in member declarations.
18 // These exercise 'Env.resolve'.
19 // Errors are localized poorly.
20 //
21 // Fields 'P3' and 'P5' are inaccessible.
23 P1 foo;
24 P1.P3 bar; // ERROR
25 P1.P3.P4 baz; // ERROR
26 P1.P3.P4.P5 quux; // ERROR
28 P1 m11() {return null;}
29 P1.P3 m12() {return null;} // ERROR
30 P1.P3.P4 m13() {return null;} // ERROR
31 P1.P3.P4.P5 m14() {return null;} // ERROR
33 void m21(P1 x) {}
34 void m22(P1.P3 x) {} // ERROR
35 void m23(P1.P3.P4 x) {} // ERROR
36 void m24(P1.P3.P4.P5 x) {} // ERROR
38 void test1() {
40 // Inaccessible types in local variable declarations.
41 // These exercise 'FieldExpression.checkCommon'.
42 //
43 // Fields 'P3' and 'P5' are inaccessible.
45 P1 foo = null;
46 P1.P3 bar = null; // ERROR
47 P1.P3.P4 baz = null; // ERROR
48 P1.P3.P4.P5 quux = null; // ERROR
49 }
51 void test2() {
53 // Inaccessible types in casts.
54 // These exercise 'FieldExpression.checkCommon'.
55 //
56 // Fields 'P3' and 'P5' are inaccessible.
58 Object foo = (P1)null;
59 Object bar = (P1.P3)null; // ERROR
60 Object baz = (P1.P3.P4)null; // ERROR
61 Object quux = (P1.P3.P4.P5)null; // ERROR
62 }
64 void test3() {
66 // Inaccessible types in 'instanceof' expressions.
67 // These exercise 'FieldExpression.checkCommon'.
68 //
69 // Fields 'P3' and 'P5' are inaccessible.
71 boolean foo = null instanceof P1;
72 boolean bar = null instanceof P1.P3; // ERROR
73 boolean baz = null instanceof P1.P3.P4; // ERROR
74 boolean quux = null instanceof P1.P3.P4.P5; // ERROR
75 }
77 }