test/tools/javac/QualifiedAccess/QualifiedAccess_2.java

Tue, 03 Jun 2008 13:26:47 -0700

author
jjg
date
Tue, 03 Jun 2008 13:26:47 -0700
changeset 46
7708bd6d800d
parent 1
9a66ca7c79fa
child 69
82c7aa6fe50a
permissions
-rw-r--r--

4075303: Use javap to enquire aboput a specific inner class
4348375: Javap is not internationalized
4459541: "javap -l" shows line numbers as signed short; they should be unsigned
4501660: change diagnostic of -help as 'print this help message and exit'
4776241: unused source file in javap...
4870651: javap should recognize generics, varargs, enum
4876942: javap invoked without args does not print help screen
4880663: javap could output whitespace between class name and opening brace
4975569: javap doesn't print new flag bits
6271787: javap dumps LocalVariableTypeTable attribute in hex, needs to print a table
6305779: javap: support annotations
6439940: Clean up javap implementation
6469569: wrong check of searchpath in JavapEnvironment
6474890: javap does not open .zip files in -classpath
6587786: Javap throws error : "ERROR:Could not find <classname>" for JRE classes
6622215: javap ignores certain relevant access flags
6622216: javap names some attributes incorrectly
6622232: javap gets whitespace confused
6622260: javap prints negative bytes incorrectly in hex
Reviewed-by: ksrini

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 *
duke@1 8 * @run shell QualifiedAccess_2.sh
duke@1 9 */
duke@1 10
duke@1 11 import pack1.P1;
duke@1 12
duke@1 13 class A {
duke@1 14 private static class B {
duke@1 15 static class Inner {}
duke@1 16 }
duke@1 17 }
duke@1 18
duke@1 19 class X extends pack1.P1 {
duke@1 20 X() { super("bar"); }
duke@1 21 void foo() {
duke@1 22 /*-----------------*
duke@1 23 // BOGUS: Reports matching constructor not found.
duke@1 24 // OK if 'Q' is made a public constructor.
duke@1 25 Object y = new Q("foo");// ERROR - protected constructor Q inaccessible
duke@1 26 *------------------*/
duke@1 27 // Reports 'P1.R.S' not found at all. (private)
duke@1 28 Object z = new R.S.T(); // ERROR - S is inaccessible
duke@1 29 }
duke@1 30 }
duke@1 31
duke@1 32 class Y {
duke@1 33
duke@1 34 class Foo {
duke@1 35 class Bar {}
duke@1 36 }
duke@1 37
duke@1 38 class C extends A.B {} // ERROR - B is inaccessible
duke@1 39 class D extends A.B.Inner {} // ERROR - B is inaccessible
duke@1 40
duke@1 41 static class Quux {
duke@1 42 private static class Quem {
duke@1 43 P1.Foo.Bar x; // ERROR - Foo is inaccessible
duke@1 44 static class MyError extends Error {}
duke@1 45 }
duke@1 46 }
duke@1 47 }
duke@1 48
duke@1 49 class Z {
duke@1 50 void foo() throws Y.Quux.Quem.MyError {
duke@1 51 // ERROR - type of Quux not accesible (private)
duke@1 52 throw new Y.Quux.Quem.MyError();
duke@1 53 // ERROR - type of Quux not accesible (private)
duke@1 54 }
duke@1 55 }

mercurial