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 4319507 4785453 |
duke@1 | 4 | * @summary Verify correct implementation of JLS2e 6.6.2.1 |
duke@1 | 5 | * @author maddox |
duke@1 | 6 | * |
jjg@611 | 7 | * @compile/fail/ref=ProtectedMemberAccess3.out -XDdiags=-simpleNames -XDdiagsFormat=%b:%l:%_%m ProtectedMemberAccess3.java |
duke@1 | 8 | */ |
duke@1 | 9 | |
duke@1 | 10 | // 46 errors expected. |
duke@1 | 11 | |
duke@1 | 12 | import pkg.SuperClass; |
duke@1 | 13 | |
duke@1 | 14 | class ProtectedMemberAccess3 { |
duke@1 | 15 | |
duke@1 | 16 | // Since this class is not a subclass of the class in which the |
duke@1 | 17 | // protected members are declared, all of the accesses are illegal. |
duke@1 | 18 | |
duke@1 | 19 | pkg.SuperClass x = new pkg.SuperClass(); |
duke@1 | 20 | |
duke@1 | 21 | static pkg.SuperClass sx = new pkg.SuperClass(); |
duke@1 | 22 | |
duke@1 | 23 | class Inner { |
duke@1 | 24 | |
duke@1 | 25 | int i = x.pi; // illegal |
duke@1 | 26 | int j = x.spi; // illegal |
duke@1 | 27 | |
duke@1 | 28 | int n = sx.pi; // illegal |
duke@1 | 29 | int m = sx.spi; // illegal |
duke@1 | 30 | |
duke@1 | 31 | //static int sn = sx.pi; |
duke@1 | 32 | //static int sm = sx.spi; |
duke@1 | 33 | |
duke@1 | 34 | int w = x.pm(); // illegal |
duke@1 | 35 | int y = x.spm(); // illegal |
duke@1 | 36 | |
duke@1 | 37 | int u = sx.pm(); // illegal |
duke@1 | 38 | int v = sx.spm(); // illegal |
duke@1 | 39 | |
duke@1 | 40 | pkg.SuperClass.pC obj1; // illegal |
duke@1 | 41 | pkg.SuperClass.spC obj2; // illegal |
duke@1 | 42 | |
duke@1 | 43 | pkg.SuperClass.pI obj3; // illegal |
duke@1 | 44 | pkg.SuperClass.spI obj4; // illegal |
duke@1 | 45 | |
duke@1 | 46 | Object o1 = (pkg.SuperClass.pC) null; // illegal |
duke@1 | 47 | Object o2 = (pkg.SuperClass.spC) null; // illegal |
duke@1 | 48 | |
duke@1 | 49 | Object o3 = (pkg.SuperClass.pI) null; // illegal |
duke@1 | 50 | Object o4 = (pkg.SuperClass.spI) null; // illegal |
duke@1 | 51 | |
duke@1 | 52 | class C1 extends pkg.SuperClass.pC {} // illegal |
duke@1 | 53 | class C2 extends pkg.SuperClass.spC {} // illegal |
duke@1 | 54 | |
duke@1 | 55 | //interface I1 extends pkg.SuperClass.pI {} |
duke@1 | 56 | //interface I2 extends pkg.SuperClass.spI {} |
duke@1 | 57 | |
duke@1 | 58 | // Not allowed in inner classes. |
duke@1 | 59 | // static { ... } |
duke@1 | 60 | |
duke@1 | 61 | void m() { |
duke@1 | 62 | |
duke@1 | 63 | pkg.SuperClass lx = new pkg.SuperClass(); |
duke@1 | 64 | |
duke@1 | 65 | x.pi = 1; // illegal |
duke@1 | 66 | x.spi = 2; // illegal |
duke@1 | 67 | |
duke@1 | 68 | sx.pi = 1; // illegal |
duke@1 | 69 | sx.spi = 2; // illegal |
duke@1 | 70 | |
duke@1 | 71 | lx.pi = 1; // illegal |
duke@1 | 72 | lx.spi = 2; // illegal |
duke@1 | 73 | |
duke@1 | 74 | int t = x.pm(); // illegal |
duke@1 | 75 | int y = x.spm(); // illegal |
duke@1 | 76 | |
duke@1 | 77 | int u = sx.pm(); // illegal |
duke@1 | 78 | int v = sx.spm(); // illegal |
duke@1 | 79 | |
duke@1 | 80 | int w = lx.pm(); // illegal |
duke@1 | 81 | int z = lx.spm(); // illegal |
duke@1 | 82 | |
duke@1 | 83 | int i = x.pi; // illegal |
duke@1 | 84 | int j = x.spi; // illegal |
duke@1 | 85 | |
duke@1 | 86 | int n = sx.pi; // illegal |
duke@1 | 87 | int m = sx.spi; // illegal |
duke@1 | 88 | |
duke@1 | 89 | int k = lx.pi; // illegal |
duke@1 | 90 | int l = lx.spi; // illegal |
duke@1 | 91 | |
duke@1 | 92 | pkg.SuperClass.pC obj1; // illegal |
duke@1 | 93 | pkg.SuperClass.spC obj2; // illegal |
duke@1 | 94 | |
duke@1 | 95 | pkg.SuperClass.pI obj3; // illegal |
duke@1 | 96 | pkg.SuperClass.spI obj4; // illegal |
duke@1 | 97 | |
duke@1 | 98 | Object o1 = (pkg.SuperClass.pC) null; // illegal |
duke@1 | 99 | Object o2 = (pkg.SuperClass.spC) null; // illegal |
duke@1 | 100 | |
duke@1 | 101 | Object o3 = (pkg.SuperClass.pI) null; // illegal |
duke@1 | 102 | Object o4 = (pkg.SuperClass.spI) null; // illegal |
duke@1 | 103 | |
duke@1 | 104 | class C1 extends pkg.SuperClass.pC {} // illegal |
duke@1 | 105 | class C2 extends pkg.SuperClass.spC {} // illegal |
duke@1 | 106 | |
duke@1 | 107 | //interface I1 extends pkg.SuperClass.pI {} |
duke@1 | 108 | //interface I2 extends pkg.SuperClass.spI {} |
duke@1 | 109 | |
duke@1 | 110 | } |
duke@1 | 111 | |
duke@1 | 112 | } |
duke@1 | 113 | |
duke@1 | 114 | } |