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 4087314 4087314 4785453 |
duke@1 | 4 | * @summary Test access checking within 'extends' and 'implements' clause. |
duke@1 | 5 | * @author William Maddox (maddox) |
jjg@611 | 6 | * @compile/fail/ref=ExtendsAccess.out -XDrawDiagnostics ExtendsAccess.java |
duke@1 | 7 | */ |
duke@1 | 8 | |
duke@1 | 9 | /* |
duke@1 | 10 | * Should compile with errors as noted. |
duke@1 | 11 | */ |
duke@1 | 12 | |
duke@1 | 13 | class ExtendsAccess { |
duke@1 | 14 | |
duke@1 | 15 | class defaultClass { } |
duke@1 | 16 | public class publicClass { } |
duke@1 | 17 | private class privateClass { } |
duke@1 | 18 | protected class protectedClass { } |
duke@1 | 19 | |
duke@1 | 20 | static class defaultStaticClass { } |
duke@1 | 21 | public static class publicStaticClass { } |
duke@1 | 22 | private static class privateStaticClass { } |
duke@1 | 23 | protected static class protectedStaticClass { } |
duke@1 | 24 | |
duke@1 | 25 | interface defaultInterface { } |
duke@1 | 26 | public interface publicInterface { } |
duke@1 | 27 | private interface privateInterface { } |
duke@1 | 28 | protected interface protectedInterface { } |
duke@1 | 29 | } |
duke@1 | 30 | |
duke@1 | 31 | class ExtendsAccess111 extends publicClass { } // ERROR - 'publicClass' not in scope |
duke@1 | 32 | class ExtendsAccess112 extends defaultClass { } // ERROR - 'defaultClass' not in scope |
duke@1 | 33 | class ExtendsAccess113 extends protectedClass { } // ERROR - 'protectedClass' not in scope |
duke@1 | 34 | class ExtendsAccess114 extends privateClass { } // ERROR - 'privateClass' not in scope |
duke@1 | 35 | |
duke@1 | 36 | class ExtendsAccess1211 extends ExtendsAccess.publicClass { } // OK - can extend inner classes (was ERROR - no enclosing instance) |
duke@1 | 37 | class ExtendsAccess1221 extends ExtendsAccess.defaultClass { } // OK - can extend inner classes (was ERROR - no enclosing instance) |
duke@1 | 38 | class ExtendsAccess1231 extends ExtendsAccess.protectedClass { } // OK - can extend inner classes (was ERROR - no enclosing instance) |
duke@1 | 39 | class ExtendsAccess1241 extends ExtendsAccess.privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 40 | |
duke@1 | 41 | class ExtendsAccess1212 extends p.ExtendsAccess.publicClass { } // OK - can extend inner classes (was ERROR - no enclosing instance) |
duke@1 | 42 | class ExtendsAccess1222 extends p.ExtendsAccess.defaultClass { } // ERROR - cannot access 'defaultClass' |
duke@1 | 43 | class ExtendsAccess1232 extends p.ExtendsAccess.protectedClass { } // ERROR - cannot access 'protectedClass' |
duke@1 | 44 | class ExtendsAccess1242 extends p.ExtendsAccess.privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 45 | |
duke@1 | 46 | class ExtendsAccess1311 extends ExtendsAccess { |
duke@1 | 47 | class N extends publicClass { } |
duke@1 | 48 | } |
duke@1 | 49 | class ExtendsAccess1321 extends ExtendsAccess { |
duke@1 | 50 | class N extends defaultClass { } |
duke@1 | 51 | } |
duke@1 | 52 | class ExtendsAccess1331 extends ExtendsAccess { |
duke@1 | 53 | class N extends protectedClass { } |
duke@1 | 54 | } |
duke@1 | 55 | class ExtendsAccess1341 extends ExtendsAccess { |
duke@1 | 56 | class N extends privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 57 | } |
duke@1 | 58 | |
duke@1 | 59 | class ExtendsAccess1312 extends p.ExtendsAccess { |
duke@1 | 60 | class N extends publicClass { } |
duke@1 | 61 | } |
duke@1 | 62 | class ExtendsAccess1322 extends p.ExtendsAccess { |
duke@1 | 63 | class N extends defaultClass { } // ERROR - cannot access 'defaultClass' |
duke@1 | 64 | } |
duke@1 | 65 | class ExtendsAccess1332 extends p.ExtendsAccess { |
duke@1 | 66 | class N extends protectedClass { } |
duke@1 | 67 | } |
duke@1 | 68 | class ExtendsAccess1342 extends p.ExtendsAccess { |
duke@1 | 69 | class N extends privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 70 | } |
duke@1 | 71 | |
duke@1 | 72 | class ExtendsAccess1411 extends ExtendsAccess { |
duke@1 | 73 | class N extends ExtendsAccess.publicClass { } |
duke@1 | 74 | } |
duke@1 | 75 | class ExtendsAccess1421 extends ExtendsAccess { |
duke@1 | 76 | class N extends ExtendsAccess.defaultClass { } |
duke@1 | 77 | } |
duke@1 | 78 | class ExtendsAccess1431 extends ExtendsAccess { |
duke@1 | 79 | class N extends ExtendsAccess.protectedClass { } |
duke@1 | 80 | } |
duke@1 | 81 | class ExtendsAccess1441 extends ExtendsAccess { |
duke@1 | 82 | class N extends ExtendsAccess1441.protectedClass { } |
duke@1 | 83 | } |
duke@1 | 84 | class ExtendsAccess1451 extends ExtendsAccess { |
duke@1 | 85 | class N extends ExtendsAccess.privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 86 | } |
duke@1 | 87 | |
duke@1 | 88 | class ExtendsAccess1412 extends p.ExtendsAccess { |
duke@1 | 89 | class N extends p.ExtendsAccess.publicClass { } |
duke@1 | 90 | } |
duke@1 | 91 | class ExtendsAccess1422 extends p.ExtendsAccess { |
duke@1 | 92 | class N extends p.ExtendsAccess.defaultClass { } // ERROR - cannot access 'defaultClass' |
duke@1 | 93 | } |
duke@1 | 94 | class ExtendsAccess1432 extends p.ExtendsAccess { |
duke@1 | 95 | class N extends p.ExtendsAccess.protectedClass { } // OK (was: should be error, see JLS 6.6.2) |
duke@1 | 96 | } |
duke@1 | 97 | class ExtendsAccess1442 extends p.ExtendsAccess { |
duke@1 | 98 | class N extends ExtendsAccess1442.protectedClass { } |
duke@1 | 99 | } |
duke@1 | 100 | class ExtendsAccess1452 extends p.ExtendsAccess { |
duke@1 | 101 | class N extends p.ExtendsAccess.privateClass { } // ERROR - cannot access 'privateClass' |
duke@1 | 102 | } |
duke@1 | 103 | |
duke@1 | 104 | class ExtendsAccess211 extends publicStaticClass { } // ERROR - 'publicStaticClass' not in scope |
duke@1 | 105 | class ExtendsAccess212 extends defaultStaticClass { } // ERROR - 'defaultStaticClass' not in scope |
duke@1 | 106 | class ExtendsAccess213 extends protectedStaticClass { } // ERROR - 'protectedStaticClass' not in scope |
duke@1 | 107 | class ExtendsAccess214 extends privateStaticClass { } // ERROR - 'privateStaticClass' not in scope |
duke@1 | 108 | |
duke@1 | 109 | class ExtendsAccess2211 extends ExtendsAccess.publicStaticClass { } |
duke@1 | 110 | class ExtendsAccess2221 extends ExtendsAccess.defaultStaticClass { } |
duke@1 | 111 | class ExtendsAccess2231 extends ExtendsAccess.protectedStaticClass { } |
duke@1 | 112 | class ExtendsAccess2241 extends ExtendsAccess.privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 113 | |
duke@1 | 114 | class ExtendsAccess2212 extends p.ExtendsAccess.publicStaticClass { } |
duke@1 | 115 | class ExtendsAccess2222 extends p.ExtendsAccess.defaultStaticClass { } // ERROR - cannot access 'defaultStaticClass' |
duke@1 | 116 | class ExtendsAccess2232 extends p.ExtendsAccess.protectedStaticClass { }// ERROR - cannot access 'protectedStaticClass' |
duke@1 | 117 | class ExtendsAccess2242 extends p.ExtendsAccess.privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 118 | |
duke@1 | 119 | class ExtendsAccess2311 extends ExtendsAccess { |
duke@1 | 120 | class N extends publicStaticClass { } |
duke@1 | 121 | } |
duke@1 | 122 | class ExtendsAccess2321 extends ExtendsAccess { |
duke@1 | 123 | class N extends defaultStaticClass { } |
duke@1 | 124 | } |
duke@1 | 125 | class ExtendsAccess2331 extends ExtendsAccess { |
duke@1 | 126 | class N extends protectedStaticClass { } |
duke@1 | 127 | } |
duke@1 | 128 | class ExtendsAccess2341 extends ExtendsAccess { |
duke@1 | 129 | class N extends privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 130 | } |
duke@1 | 131 | |
duke@1 | 132 | class ExtendsAccess2312 extends p.ExtendsAccess { |
duke@1 | 133 | class N extends publicStaticClass { } |
duke@1 | 134 | } |
duke@1 | 135 | class ExtendsAccess2322 extends p.ExtendsAccess { |
duke@1 | 136 | class N extends defaultStaticClass { } // ERROR - cannot access 'defaultStaticClass' |
duke@1 | 137 | } |
duke@1 | 138 | class ExtendsAccess2332 extends p.ExtendsAccess { |
duke@1 | 139 | class N extends protectedStaticClass { } |
duke@1 | 140 | } |
duke@1 | 141 | class ExtendsAccess2342 extends p.ExtendsAccess { |
duke@1 | 142 | class N extends privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 143 | } |
duke@1 | 144 | |
duke@1 | 145 | class ExtendsAccess2411 extends ExtendsAccess { |
duke@1 | 146 | class N extends ExtendsAccess.publicStaticClass { } |
duke@1 | 147 | } |
duke@1 | 148 | class ExtendsAccess2421 extends ExtendsAccess { |
duke@1 | 149 | class N extends ExtendsAccess.defaultStaticClass { } |
duke@1 | 150 | } |
duke@1 | 151 | class ExtendsAccess2431 extends ExtendsAccess { |
duke@1 | 152 | class N extends ExtendsAccess.protectedStaticClass { } // OK (was should be error, see JLS 6.6.2) |
duke@1 | 153 | } |
duke@1 | 154 | class ExtendsAccess2441 extends ExtendsAccess { |
duke@1 | 155 | class N extends ExtendsAccess2431.protectedStaticClass { } |
duke@1 | 156 | } |
duke@1 | 157 | class ExtendsAccess2451 extends ExtendsAccess { |
duke@1 | 158 | class N extends ExtendsAccess.privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 159 | } |
duke@1 | 160 | |
duke@1 | 161 | class ExtendsAccess2412 extends p.ExtendsAccess { |
duke@1 | 162 | class N extends p.ExtendsAccess.publicStaticClass { } |
duke@1 | 163 | } |
duke@1 | 164 | class ExtendsAccess2422 extends p.ExtendsAccess { |
duke@1 | 165 | class N extends p.ExtendsAccess.defaultStaticClass { } // ERROR - cannot access 'defaultStaticClass' |
duke@1 | 166 | } |
duke@1 | 167 | class ExtendsAccess2432 extends p.ExtendsAccess { |
duke@1 | 168 | class N extends p.ExtendsAccess.protectedStaticClass { } // OK (was: should be error, see JLS 6.6.2) |
duke@1 | 169 | } |
duke@1 | 170 | class ExtendsAccess2442 extends p.ExtendsAccess { |
duke@1 | 171 | class N extends ExtendsAccess2442.protectedStaticClass { } |
duke@1 | 172 | } |
duke@1 | 173 | class ExtendsAccess2452 extends p.ExtendsAccess { |
duke@1 | 174 | class N extends p.ExtendsAccess.privateStaticClass { } // ERROR - cannot access 'privateStaticClass' |
duke@1 | 175 | } |
duke@1 | 176 | |
duke@1 | 177 | class ExtendsAccess311 extends ExtendsAccess implements publicInterface { } // ERROR - 'publicInterface' not in scope |
duke@1 | 178 | class ExtendsAccess312 extends ExtendsAccess implements defaultInterface { } // ERROR - 'defaultInterface' not in scope |
duke@1 | 179 | class ExtendsAccess313 extends ExtendsAccess implements protectedInterface { } // ERROR - 'protectedInterface' not in scope |
duke@1 | 180 | class ExtendsAccess314 extends ExtendsAccess implements privateInterface { } // ERROR - 'privateInterface' not in scope |
duke@1 | 181 | |
duke@1 | 182 | class ExtendsAccess3211 extends ExtendsAccess implements ExtendsAccess.publicInterface { } |
duke@1 | 183 | class ExtendsAccess3221 extends ExtendsAccess implements ExtendsAccess.defaultInterface { } |
duke@1 | 184 | class ExtendsAccess3231 extends ExtendsAccess implements ExtendsAccess.protectedInterface { } |
duke@1 | 185 | class ExtendsAccess3241 extends ExtendsAccess |
duke@1 | 186 | implements ExtendsAccess.privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 187 | |
duke@1 | 188 | class ExtendsAccess3212 extends ExtendsAccess |
duke@1 | 189 | implements p.ExtendsAccess.publicInterface { } |
duke@1 | 190 | class ExtendsAccess3222 extends ExtendsAccess |
duke@1 | 191 | implements p.ExtendsAccess.defaultInterface { } // ERROR - cannot access 'defaultStaticClass' |
duke@1 | 192 | class ExtendsAccess3232 extends ExtendsAccess |
duke@1 | 193 | implements p.ExtendsAccess.protectedInterface { } // ERROR - cannot access 'protectedStaticClass' |
duke@1 | 194 | class ExtendsAccess3242 extends ExtendsAccess |
duke@1 | 195 | implements p.ExtendsAccess.privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 196 | |
duke@1 | 197 | class ExtendsAccess331 extends ExtendsAccess { |
duke@1 | 198 | class N implements publicInterface { } |
duke@1 | 199 | } |
duke@1 | 200 | class ExtendsAccess3321 extends ExtendsAccess { |
duke@1 | 201 | class N implements defaultInterface { } |
duke@1 | 202 | } |
duke@1 | 203 | class ExtendsAccess3331 extends ExtendsAccess { |
duke@1 | 204 | class N implements protectedInterface { } |
duke@1 | 205 | } |
duke@1 | 206 | class ExtendsAccess3341 extends ExtendsAccess { |
duke@1 | 207 | class N implements privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 208 | } |
duke@1 | 209 | |
duke@1 | 210 | class ExtendsAccess3312 extends p.ExtendsAccess { |
duke@1 | 211 | class N implements publicInterface { } |
duke@1 | 212 | } |
duke@1 | 213 | class ExtendsAccess3322 extends p.ExtendsAccess { |
duke@1 | 214 | class N implements defaultInterface { } // ERROR - cannot access 'defaultStaticClass' |
duke@1 | 215 | } |
duke@1 | 216 | class ExtendsAccess3332 extends p.ExtendsAccess { |
duke@1 | 217 | class N implements protectedInterface { } |
duke@1 | 218 | } |
duke@1 | 219 | class ExtendsAccess3342 extends p.ExtendsAccess { |
duke@1 | 220 | class N implements privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 221 | } |
duke@1 | 222 | |
duke@1 | 223 | class ExtendsAccess341 extends ExtendsAccess { |
duke@1 | 224 | class N implements ExtendsAccess.publicInterface { } |
duke@1 | 225 | } |
duke@1 | 226 | class ExtendsAccess3421 extends ExtendsAccess { |
duke@1 | 227 | class N implements ExtendsAccess.defaultInterface { } |
duke@1 | 228 | } |
duke@1 | 229 | class ExtendsAccess3431 extends ExtendsAccess { |
duke@1 | 230 | class N implements ExtendsAccess.protectedInterface { } // OK (was: should be error, see JLS 6.2.2) |
duke@1 | 231 | } |
duke@1 | 232 | class ExtendsAccess3441 extends ExtendsAccess { |
duke@1 | 233 | class N implements ExtendsAccess3441.protectedInterface { } |
duke@1 | 234 | } |
duke@1 | 235 | class ExtendsAccess3451 extends ExtendsAccess { |
duke@1 | 236 | class N implements ExtendsAccess.privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 237 | } |
duke@1 | 238 | |
duke@1 | 239 | class ExtendsAccess342 extends p.ExtendsAccess { |
duke@1 | 240 | class N implements p.ExtendsAccess.publicInterface { } |
duke@1 | 241 | } |
duke@1 | 242 | class ExtendsAccess3422 extends p.ExtendsAccess { |
duke@1 | 243 | class N implements p.ExtendsAccess.defaultInterface { } // ERROR - cannot access 'defaultClass' |
duke@1 | 244 | } |
duke@1 | 245 | class ExtendsAccess3432 extends p.ExtendsAccess { |
duke@1 | 246 | class N implements p.ExtendsAccess.protectedInterface { } // OK (was: should be error, see JLS 6.2.2) |
duke@1 | 247 | } |
duke@1 | 248 | class ExtendsAccess3442 extends p.ExtendsAccess { |
duke@1 | 249 | class N implements ExtendsAccess3442.protectedInterface { } |
duke@1 | 250 | } |
duke@1 | 251 | class ExtendsAccess3452 extends p.ExtendsAccess { |
duke@1 | 252 | class N implements p.ExtendsAccess.privateInterface { } // ERROR - cannot access 'privateInterface' |
duke@1 | 253 | } |