BridgeMethodsTemplateTest.java revision 3170:dc017a37aac5
1/* 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24import java.io.IOException; 25 26import org.testng.annotations.Test; 27 28/** 29 * BridgeMethodsTemplateTest 30 * 31 * @author Brian Goetz 32 */ 33@Test 34public class BridgeMethodsTemplateTest extends BridgeMethodTestCase { 35 36 /* 37 * Cc1(A) -> Cc1(Ac0) 38 * 39 * 0*: Inherited from A 40 * 1: Declared in C 41 */ 42 public void test1() throws IOException, ReflectiveOperationException { 43 compileSpec("Cc1(A)"); 44 assertLinkage("C", LINKAGE_ERROR, "C1"); 45 recompileSpec("Cc1(Ac0)", "A"); 46 assertLinkage("C", "A0", "C1"); 47 } 48 49 /* 50 * Cc1(I) -> Cc1(Id0) 51 * 52 * 0*: Inherited default from I 53 * 1: Declared in C 54 */ 55 public void test2() throws IOException, ReflectiveOperationException { 56 compileSpec("Cc1(I)"); 57 assertLinkage("C", LINKAGE_ERROR, "C1"); 58 recompileSpec("Cc1(Id0)", "I"); 59 assertLinkage("C", "I0", "C1"); 60 } 61 62 /* 63 * C(Bc1(A)) -> C(Bc1(Ac0)) 64 * 65 * 0*: Inherited from A 66 * 1: Inherited from B 67 */ 68 public void test3() throws IOException, ReflectiveOperationException { 69 compileSpec("C(Bc1(A))"); 70 assertLinkage("C", LINKAGE_ERROR, "B1"); 71 recompileSpec("C(Bc1(Ac0))", "A"); 72 assertLinkage("C", "A0", "B1"); 73 } 74 75 /* 76 * C(B(Ac0)) -> C(Bc1(Ac0)) 77 * 78 * 0: Inherited from B (through bridge) 79 * 1: Inherited from B 80 */ 81 public void test4() throws IOException, ReflectiveOperationException { 82 compileSpec("C(B(Ac0))"); 83 assertLinkage("C", "A0", LINKAGE_ERROR); 84 recompileSpec("C(Bc1(Ac0))", "B"); 85 assertLinkage("C", "B1", "B1"); 86 } 87 88 /* 89 * C(B(A)) -> C(Bc1(Ac0)) 90 * 91 * 0: Inherited from B (through bridge) 92 * 1: Inherited from B 93 */ 94 public void test5() throws IOException, ReflectiveOperationException { 95 compileSpec("C(B(A))"); 96 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR); 97 recompileSpec("C(Bc1(Ac0))", "A", "B"); 98 assertLinkage("C", "B1", "B1"); 99 } 100 101 /* 102 * C(Ac1(I)) -> C(Ac1(Id0)) 103 * 104 * 0*: Inherited default from I 105 * 1: Inherited from A 106 */ 107 public void test6() throws IOException, ReflectiveOperationException { 108 compileSpec("C(Ac1(I))"); 109 assertLinkage("C", LINKAGE_ERROR, "A1"); 110 recompileSpec("C(Ac1(Id0))", "I"); 111 assertLinkage("C", "I0", "A1"); 112 } 113 114 /* 115 * C(A(Id0)) -> C(Ac1(Id0)) 116 * 117 * 0: Inherited from A (through bridge) 118 * 1: Inherited from A 119 */ 120 public void test7() throws IOException, ReflectiveOperationException { 121 compileSpec("C(A(Id0))"); 122 assertLinkage("C", "I0", LINKAGE_ERROR); 123 recompileSpec("C(Ac1(Id0))", "A"); 124 assertLinkage("C", "A1", "A1"); 125 } 126 127 /* 128 * C(A(I)) -> C(Ac1(Id0)) 129 * 130 * 0*: Inherited from A (through bridge) 131 * 1*: Inherited from A 132 */ 133 public void test8() throws IOException, ReflectiveOperationException { 134 compileSpec("C(A(I))"); 135 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR); 136 recompileSpec("C(Ac1(Id0))", "A", "I"); 137 assertLinkage("C", "A1", "A1"); 138 } 139 140 /* 141 * C(Id1(J)) -> C(Id1(Jd0)) 142 * 143 * 0*: Inherited default from J 144 * 1: Inherited default from I 145 */ 146 public void test9() throws IOException, ReflectiveOperationException { 147 compileSpec("C(Id1(J))"); 148 assertLinkage("C", LINKAGE_ERROR, "I1"); 149 recompileSpec("C(Id1(Jd0))", "J"); 150 assertLinkage("C", "J0", "I1"); 151 } 152 153 /* 154 * C(I(Jd0)) -> C(Id1(Jd0)) 155 * 156 * 0: Inherited default from I (through bridge) 157 * 1: Inherited default from I 158 */ 159 public void test10() throws IOException, ReflectiveOperationException { 160 compileSpec("C(I(Jd0))"); 161 assertLinkage("C", "J0", LINKAGE_ERROR); 162 recompileSpec("C(Id1(Jd0))", "I"); 163 assertLinkage("C", "I1", "I1"); 164 } 165 166 /* 167 * C(I(J)) -> C(Id1(Jd0)) 168 * 169 * 0: Inherited default from I (through bridge) 170 * 1: Inherited default from I 171 */ 172 public void test11() throws IOException, ReflectiveOperationException { 173 compileSpec("C(I(J))"); 174 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR); 175 recompileSpec("C(Id1(Jd0))", "I", "J"); 176 assertLinkage("C", "I1", "I1"); 177 } 178 179 /* 180 * Cc2(B(Ac0)) -> Cc2(Bc1(Ac0)) 181 * 182 * 0: Declared in C (through bridge) 183 * 1*: Inherited from B 184 * 2: Declared in C 185 */ 186 public void test12() throws IOException, ReflectiveOperationException { 187 compileSpec("Cc2(B(Ac0))"); 188 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 189 recompileSpec("Cc2(Bc1(Ac0))", "B"); 190 assertLinkage("C", "C2", "B1", "C2"); 191 } 192 193 /* 194 * Cc2(B(Aa0)) -> Cc2(Bc1(Aa0)) 195 * 196 * 0: Bridge in C (through bridge) 197 * 1*: Inherited from B 198 * 2: Declared in C 199 */ 200 public void test13() throws IOException, ReflectiveOperationException { 201 compileSpec("Cc2(B(Aa0))"); 202 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 203 recompileSpec("Cc2(Bc1(Aa0))", "B"); 204 assertLinkage("C", "C2", "B1", "C2"); 205 } 206 207 /* 208 * Cc2(Bc1(A)) -> Cc2(Bc1(Ac0)) 209 * 210 * 0*: Inherited from A 211 * 1: Declared in C (through bridge) 212 * 2: Declared in C 213 */ 214 public void test14() throws IOException, ReflectiveOperationException { 215 compileSpec("Cc2(Bc1(A))"); 216 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 217 recompileSpec("Cc2(Bc1(Ac0))", "A"); 218 assertLinkage("C", "A0", "C2", "C2"); 219 } 220 221 /* 222 * Cc2(Ba1(A)) -> Cc2(Ba1(Ac0)) 223 * 224 * 0*: Inherited from A 225 * 1: Declared in C (through bridge) 226 * 2: Declared in C 227 */ 228 public void test15() throws IOException, ReflectiveOperationException { 229 compileSpec("Cc2(Ba1(A))"); 230 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 231 recompileSpec("Cc2(Ba1(Ac0))", "A"); 232 assertLinkage("C", "A0", "C2", "C2"); 233 } 234 235 /* 236 * Cc2(B(A)) -> Cc2(Bc1(Ac0)) 237 * 238 * 0*: Inherited from B (through bridge) 239 * 1*: Inherited from B 240 * 2: Declared in C 241 */ 242 public void test16() throws IOException, ReflectiveOperationException { 243 compileSpec("Cc2(B(A))"); 244 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2"); 245 recompileSpec("Cc2(Bc1(Ac0))", "B", "A"); 246 assertLinkage("C", "B1", "B1", "C2"); 247 } 248 249 /* 250 * Cc2(A(Id0)) -> Cc2(Ac1(Id0)) 251 * 252 * 0: Declared in C (through bridge) 253 * 1*: Inherited from A 254 * 2: Declared in C 255 */ 256 public void test17() throws IOException, ReflectiveOperationException { 257 compileSpec("Cc2(A(Id0))"); 258 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 259 recompileSpec("Cc2(Ac1(Id0))", "A"); 260 assertLinkage("C", "C2", "A1", "C2"); 261 } 262 263 /* 264 * Cc2(A(Ia0)) -> Cc2(Ac1(Ia0)) 265 * 266 * 0: Declared in C (through bridge) 267 * 1*: Inherited from A 268 * 2: Declared in C 269 */ 270 public void test18() throws IOException, ReflectiveOperationException { 271 compileSpec("Cc2(A(Ia0))"); 272 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 273 recompileSpec("Cc2(Ac1(Ia0))", "A"); 274 assertLinkage("C", "C2", "A1", "C2"); 275 } 276 277 /* 278 * Cc2(Ac1(I)) -> Cc2(Ac1(Id0)) 279 * 280 * 0*: Inherited from I 281 * 1: Declared in C (through bridge) 282 * 2: Declared in C 283 */ 284 public void test19() throws IOException, ReflectiveOperationException { 285 compileSpec("Cc2(Ac1(I))"); 286 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 287 recompileSpec("Cc2(Ac1(Id0))", "I"); 288 assertLinkage("C", "I0", "C2", "C2"); 289 } 290 291 /* 292 * Cc2(Aa1(I)) -> Cc2(Aa1(Id0)) 293 * 294 * 0*: Inherited from I 295 * 1: Declared in C (through bridge) 296 * 2: Declared in C 297 */ 298 public void test20() throws IOException, ReflectiveOperationException { 299 compileSpec("Cc2(Aa1(I))"); 300 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 301 recompileSpec("Cc2(Aa1(Id0))", "I"); 302 assertLinkage("C", "I0", "C2", "C2"); 303 } 304 305 /* 306 * Cc2(A(I)) -> Cc2(Ac1(Id0)) 307 * 308 * 0*: Inherited from A (through bridge) 309 * 1*: Inherited from A 310 * 2: Declared in C 311 */ 312 public void test21() throws IOException, ReflectiveOperationException { 313 compileSpec("Cc2(A(I))"); 314 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2"); 315 recompileSpec("Cc2(Ac1(Id0))", "A", "I"); 316 assertLinkage("C", "A1", "A1", "C2"); 317 } 318 319 /* 320 * Cc2(J(Id0)) -> Cc2(Jd1(Id0)) 321 * 322 * 0: Declared in C (through bridge) 323 * 1*: Inherited default from J 324 * 2: Declared in C 325 */ 326 public void test22() throws IOException, ReflectiveOperationException { 327 compileSpec("Cc2(J(Id0))"); 328 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 329 recompileSpec("Cc2(Jd1(Id0))", "J"); 330 assertLinkage("C", "C2", "J1", "C2"); 331 } 332 333 /* 334 * Cc2(J(Ia0)) -> Cc2(Jd1(Ia0)) 335 * 336 * 0: Declared in C (through bridge) 337 * 1*: Inherited default from J 338 * 2: Declared in C 339 */ 340 public void test23() throws IOException, ReflectiveOperationException { 341 compileSpec("Cc2(J(Ia0))"); 342 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 343 recompileSpec("Cc2(Jd1(Ia0))", "J"); 344 assertLinkage("C", "C2", "J1", "C2"); 345 } 346 347 /* 348 * Cc2(Jd1(I)) -> Cc2(Jd1(Id0)) 349 * 350 * 0*: Inherited default from I 351 * 1: Declared in C (through bridge) 352 * 2: Declared in C 353 */ 354 public void test24() throws IOException, ReflectiveOperationException { 355 compileSpec("Cc2(Jd1(I))"); 356 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 357 recompileSpec("Cc2(Jd1(Id0))", "I"); 358 assertLinkage("C", "I0", "C2", "C2"); 359 } 360 361 /* 362 * Cc2(Ja1(I)) -> Cc2(Ja1(Id0)) 363 * 364 * 0*: Inherited default from I 365 * 1: Declared in C (through bridge) 366 * 2: Declared in C 367 */ 368 public void test25() throws IOException, ReflectiveOperationException { 369 compileSpec("Cc2(Ja1(I))"); 370 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 371 recompileSpec("Cc2(Ja1(Id0))", "I"); 372 assertLinkage("C", "I0", "C2", "C2"); 373 } 374 375 /* 376 * Cc2(J(I)) -> Cc2(Jd1(Id0)) 377 * 378 * 0*: Inherited default from J (through bridge) 379 * 1*: Inherited default from J 380 * 2: Declared in C 381 */ 382 public void test26() throws IOException, ReflectiveOperationException { 383 compileSpec("Cc2(J(I))"); 384 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2"); 385 recompileSpec("Cc2(Jd1(Id0))", "J", "I"); 386 assertLinkage("C", "J1", "J1", "C2"); 387 } 388 389 /* 390 * C(Ac1, I) -> C(Ac1, Id0) 391 * 392 * 0*: Inherited default from I 393 * 1: Inherited from A 394 */ 395 public void test27() throws IOException, ReflectiveOperationException { 396 compileSpec("C(Ac1,I)"); 397 assertLinkage("C", LINKAGE_ERROR, "A1"); 398 recompileSpec("C(Ac1,Id0)", "I"); 399 assertLinkage("C", "I0", "A1"); 400 } 401 402 /* 403 * C(A, Id0) -> C(Ac1, Id0) 404 * 405 * 0*: Inherited default from I 406 * 1: Inherited from A 407 */ 408 public void test28() throws IOException, ReflectiveOperationException { 409 compileSpec("C(A,Id0)"); 410 assertLinkage("C", "I0", LINKAGE_ERROR); 411 recompileSpec("C(Ac1,Id0)", "A"); 412 assertLinkage("C", "I0", "A1"); 413 } 414 415 /* 416 * C(A, I) -> C(Ac1, Id0) 417 * 418 * 0*: Inherited default from I 419 * 1: Inherited from A 420 */ 421 public void test29() throws IOException, ReflectiveOperationException { 422 compileSpec("C(A,I)"); 423 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR); 424 recompileSpec("C(Ac1,Id0)", "A", "I"); 425 assertLinkage("C", "I0", "A1"); 426 } 427 428 /* 429 * Cc2(Ac1, I) -> Cc2(Ac1, Id0) 430 * 431 * 0*: Inherited default from I 432 * 1: Declared in C (through bridge) 433 * 2: Declared in C 434 */ 435 public void test30() throws IOException, ReflectiveOperationException { 436 compileSpec("Cc2(Ac1,I)"); 437 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 438 recompileSpec("Cc2(Ac1,Id0)", "I"); 439 assertLinkage("C", "I0", "C2", "C2"); 440 } 441 442 /* 443 * Cc2(Aa1, I) -> Cc2(Aa1, Id0) 444 * 445 * 0*: Inherited default from I 446 * 1: Declared in C (through bridge) 447 * 2: Declared in C 448 */ 449 public void test31() throws IOException, ReflectiveOperationException { 450 compileSpec("Cc2(Aa1,I)"); 451 assertLinkage("C", LINKAGE_ERROR, "C2", "C2"); 452 recompileSpec("Cc2(Aa1,Id0)", "I"); 453 assertLinkage("C", "I0", "C2", "C2"); 454 } 455 456 /* 457 * Cc2(A, Id0) -> Cc2(Ac1, Id0) 458 * 459 * 0: Declared in C (through bridge) 460 * 1*: Inherited from A 461 * 2: Declared in C 462 */ 463 public void test32() throws IOException, ReflectiveOperationException { 464 compileSpec("Cc2(A,Id0)"); 465 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 466 recompileSpec("Cc2(Ac1,Id0)", "A"); 467 assertLinkage("C", "C2", "A1", "C2"); 468 } 469 470 /* 471 * Cc2(A, Ia0) -> Cc2(Ac1, Ia0) 472 * 473 * 0: Declared in C (through bridge) 474 * 1*: Inherited from A 475 * 2: Declared in C 476 */ 477 public void test33() throws IOException, ReflectiveOperationException { 478 compileSpec("Cc2(A,Ia0)"); 479 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 480 recompileSpec("Cc2(Ac1,Ia0)", "A"); 481 assertLinkage("C", "C2", "A1", "C2"); 482 } 483 484 /* 485 * Cc2(A, I) -> Cc2(Ac1, Id0) 486 * 487 * 0*: Inherited from A 488 * 1*: Inherited default from I 489 * 2: Declared in C 490 */ 491 public void test34() throws IOException, ReflectiveOperationException { 492 compileSpec("Cc2(A,I)"); 493 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2"); 494 recompileSpec("Cc2(Ac1,Id0)", "A", "I"); 495 assertLinkage("C", "I0", "A1", "C2"); 496 } 497 498 /* 499 * Cc2(Id0, J) -> Cc2(Id0, Jd1) 500 * 501 * 0: Declared in C (through bridge) 502 * 1*: Inherited default from J 503 * 2: Declared in C 504 */ 505 public void test35() throws IOException, ReflectiveOperationException { 506 compileSpec("Cc2(Id0,J)"); 507 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 508 recompileSpec("Cc2(Id0,Jd1)", "J"); 509 assertLinkage("C", "C2", "J1", "C2"); 510 } 511 512 /* 513 * Cc2(Ia0, J) -> Cc2(Ia0, Jd1) 514 * 515 * 0: Declared in C (through bridge) 516 * 1*: Inherited default from J 517 * 2: Declared in C 518 */ 519 public void test36() throws IOException, ReflectiveOperationException { 520 compileSpec("Cc2(Ia0,J)"); 521 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 522 recompileSpec("Cc2(Ia0,Jd1)", "J"); 523 assertLinkage("C", "C2", "J1", "C2"); 524 } 525 526 /* 527 * Cc2(I, J) -> Cc2(Id0, Jd1) 528 * 529 * 0*: Inherited default from I 530 * 1*: Inherited default from J 531 * 2: Declared in C 532 */ 533 public void test37() throws IOException, ReflectiveOperationException { 534 compileSpec("Cc2(I,J)"); 535 assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2"); 536 recompileSpec("Cc2(Id0,Jd1)", "I", "J"); 537 assertLinkage("C", "I0", "J1", "C2"); 538 } 539 540 /* 541 * C(A(Id0), J(Id0)) -> C(Ac1(Id0), J(Id0)) 542 * 543 * 0: Inherited default from I 544 * 0*: Inherited from A (through bridge) 545 * 1*: Inherited from A 546 */ 547 public void test38() throws IOException, ReflectiveOperationException { 548 compileSpec("C(A(Id0),J(Id0))"); 549 assertLinkage("C", "I0", LINKAGE_ERROR); 550 recompileSpec("C(Ac1(Id0),J(Id0))", "A"); 551 assertLinkage("C", "A1", "A1"); 552 } 553 554 /* 555 * C(A(Id0), J(Id0)) -> C(A(Id0), Jd1(Id0)) 556 * 557 * 0: Inherited default from I 558 * 0: Inherited default from J (through bridge) 559 * 1*: Inherited default from J 560 */ 561 public void test39() throws IOException, ReflectiveOperationException { 562 compileSpec("C(A(Id0),J(Id0))"); 563 assertLinkage("C", "I0", LINKAGE_ERROR); 564 recompileSpec("C(A(Id0),Jd1(Id0))", "J"); 565 assertLinkage("C", "J1", "J1"); 566 } 567 568 /* 569 * C(A(Id0), J(Id0)) -> C(Ac2(Id0), Jd1(Id0)) 570 * 571 * 0: Inherited default from I 572 * 0*: Inherited from A (new bridge in A beats new bridge in J) 573 * 1*: Inherited default from J 574 * 2: Inherited from A 575 */ 576 public void test40() throws IOException, ReflectiveOperationException { 577 compileSpec("C(A(Id0),J(Id0))"); 578 assertLinkage("C", "I0", LINKAGE_ERROR); 579 recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A", "J"); 580 assertLinkage("C", "A2", "J1", "A2"); 581 } 582 583 /* 584 * C(J(Id0), K(Id0)) -> C(Jd1(Id0), K(Id0)) 585 * 586 * 0: Inherited from I 587 * 0*: Inherited default from J (through bridge) 588 * 1: Inherited default from J 589 */ 590 public void test41() throws IOException, ReflectiveOperationException { 591 compileSpec("C(J(Id0),K(Id0))"); 592 assertLinkage("C", "I0", LINKAGE_ERROR); 593 recompileSpec("C(Jd1(Id0),K(Id0))", "J"); 594 assertLinkage("C", "J1", "J1"); 595 } 596 597 /* 598 * C(Ac2(Id0), J(Id0)) -> C(Ac2(Id0), Jd1(Id0)) 599 * 600 * 0: Inherited from A (bridge in A beats new bridge in J) 601 * 1*: Inherited default from J 602 * 2: Inherited from A 603 */ 604 public void test42() throws IOException, ReflectiveOperationException { 605 compileSpec("C(Ac2(Id0),J(Id0))"); 606 assertLinkage("C", "A2", LINKAGE_ERROR, "A2"); 607 recompileSpec("C(Ac2(Id0),Jd1(Id0))", "J"); 608 assertLinkage("C", "A2", "J1", "A2"); 609 } 610 611 /* 612 * C(Ac2(Ia0), J(Ia0)) -> C(Ac2(Ia0), Jd1(Ia0)) 613 * 614 * 0: Inherited from A (bridge in A beats new bridge in J) 615 * 1*: Inherited default from J 616 * 2: Inherited from A 617 */ 618 public void test43() throws IOException, ReflectiveOperationException { 619 compileSpec("C(Ac2(Ia0),J(Ia0))"); 620 assertLinkage("C", "A2", LINKAGE_ERROR, "A2"); 621 recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "J"); 622 assertLinkage("C", "A2", "J1", "A2"); 623 } 624 625 /* 626 * C(A(Id0), Jd1(Id0)) -> C(Ac2(Id0), Jd1(Id0)) 627 * 628 * 0: Inherited from J 629 * 0*: Inherited from A (new bridge in A beats bridge in J) 630 * 1: Inherited default from J 631 * 2*: Inherited from A 632 */ 633 public void test44() throws IOException, ReflectiveOperationException { 634 compileSpec("C(A(Id0),Jd1(Id0))"); 635 assertLinkage("C", "J1", "J1", LINKAGE_ERROR); 636 recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A"); 637 assertLinkage("C", "A2", "J1", "A2"); 638 } 639 640 /* 641 * C(A(Ia0), Jd1(Ia0)) -> C(Ac2(Ia0), Jd1(Ia0)) 642 * 643 * 0: Inherited from J 644 * 0*: Inherited from A (new bridge in A beats bridge in J) 645 * 1: Inherited default from J 646 * 2*: Inherited from A 647 */ 648 public void test45() throws IOException, ReflectiveOperationException { 649 compileSpec("C(A(Ia0),Jd1(Ia0))"); 650 assertLinkage("C", "J1", "J1", LINKAGE_ERROR); 651 recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "A"); 652 assertLinkage("C", "A2", "J1", "A2"); 653 } 654 655 /* 656 * Cc2(A(Id0), J(Id0)) -> Cc2(Ac1(Id0), J(Id0)) 657 * 658 * 0: Declared in C (through bridge) 659 * 1*: Inherited from A 660 * 2: Declared in C 661 */ 662 public void test46() throws IOException, ReflectiveOperationException { 663 compileSpec("Cc2(A(Id0),J(Id0))"); 664 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 665 recompileSpec("Cc2(Ac1(Id0),J(Id0))", "A"); 666 assertLinkage("C", "C2", "A1", "C2"); 667 } 668 669 /* 670 * Cc2(A(Ia0), J(Ia0)) -> Cc2(Ac1(Ia0), J(Ia0)) 671 * 672 * 0: Declared in C (through bridge) 673 * 1*: Inherited from A 674 * 2: Declared in C 675 */ 676 public void test47() throws IOException, ReflectiveOperationException { 677 compileSpec("Cc2(A(Ia0),J(Ia0))"); 678 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 679 recompileSpec("Cc2(Ac1(Ia0),J(Ia0))", "A"); 680 assertLinkage("C", "C2", "A1", "C2"); 681 } 682 683 /* 684 * Cc2(A(Id0), J(Id0)) -> Cc2(A(Id0), Jd1(Id0)) 685 * 686 * 0: Declared in C (through bridge) 687 * 1*: Inherited default from J 688 * 2: Declared in C 689 */ 690 public void test48() throws IOException, ReflectiveOperationException { 691 compileSpec("Cc2(A(Id0),J(Id0))"); 692 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 693 recompileSpec("Cc2(A(Id0),Jd1(Id0))", "J"); 694 assertLinkage("C", "C2", "J1", "C2"); 695 } 696 697 /* 698 * Cc2(A(Ia0), J(Ia0)) -> Cc2(A(Ia0), Jd1(Ia0)) 699 * 700 * 0: Declared in C (through bridge) 701 * 1*: Inherited default from J 702 * 2: Declared in C 703 */ 704 public void test49() throws IOException, ReflectiveOperationException { 705 compileSpec("Cc2(A(Ia0),J(Ia0))"); 706 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 707 recompileSpec("Cc2(A(Ia0),Jd1(Ia0))", "J"); 708 assertLinkage("C", "C2", "J1", "C2"); 709 } 710 711 712 /* 713 * Cc3(A(Id0), J(Id0)) -> Cc3(Ac1(Id0), Jd2(Id0)) 714 * 715 * 0: Bridge in C 716 * 1*: Inherited from A 717 * 2*: Inherited default from J 718 * 3: Declared in C 719 */ 720 public void test50() throws IOException, ReflectiveOperationException { 721 compileSpec("Cc3(A(Id0),J(Id0))"); 722 assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3"); 723 recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A", "J"); 724 assertLinkage("C", "C3", "A1", "J2", "C3"); 725 } 726 727 /* 728 * Cc3(A(Ia0), J(Ia0)) -> Cc3(Ac1(Ia0), Jd2(Ia0)) 729 * 730 * 0: Bridge in C 731 * 1*: Inherited from A 732 * 2*: Inherited default from J 733 * 3: Declared in C 734 */ 735 public void test51() throws IOException, ReflectiveOperationException { 736 compileSpec("Cc3(A(Ia0),J(Ia0))"); 737 assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3"); 738 recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A", "J"); 739 assertLinkage("C", "C3", "A1", "J2", "C3"); 740 } 741 742 /* 743 * Cc2(J(Id0), K(Id0)) -> Cc2(Jd1(Id0), K(Id0)) 744 * 745 * 0: Declared in C (through bridge) 746 * 1*: Inherited default from J 747 * 2: Declared in C 748 */ 749 public void test52() throws IOException, ReflectiveOperationException { 750 compileSpec("Cc2(J(Id0),K(Id0))"); 751 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 752 recompileSpec("Cc2(Jd1(Id0),K(Id0))", "J"); 753 assertLinkage("C", "C2", "J1", "C2"); 754 } 755 756 /* 757 * Cc2(J(Ia0), K(Ia0)) -> Cc2(Jd1(Ia0), K(Ia0)) 758 * 759 * 0: Declared in C (through bridge) 760 * 1*: Inherited default from J 761 * 2: Declared in C 762 */ 763 public void test53() throws IOException, ReflectiveOperationException { 764 compileSpec("Cc2(J(Ia0),K(Ia0))"); 765 assertLinkage("C", "C2", LINKAGE_ERROR, "C2"); 766 recompileSpec("Cc2(Jd1(Ia0),K(Ia0))", "J"); 767 assertLinkage("C", "C2", "J1", "C2"); 768 } 769 770 /* 771 * Cc3(J(Id0), K(Id0)) -> Cc3(Jd1(Id0), Kd2(Id0)) 772 * 773 * 0: Declared in C (through bridge) 774 * 1*: Inherited default from J 775 * 2*: Inherited default from K 776 * 3: Declared in C 777 */ 778 public void test54() throws IOException, ReflectiveOperationException { 779 compileSpec("Cc3(J(Id0),K(Id0))"); 780 assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3"); 781 recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "J", "K"); 782 assertLinkage("C", "C3", "J1", "K2", "C3"); 783 } 784 785 /* 786 * Cc3(J(Ia0), K(Ia0)) -> Cc3(Jd1(Ia0), Kd2(Ia0)) 787 * 788 * 0: Declared in C (through bridge) 789 * 1*: Inherited default from J 790 * 2*: Inherited default from K 791 * 3: Declared in C 792 */ 793 public void test55() throws IOException, ReflectiveOperationException { 794 compileSpec("Cc3(J(Ia0),K(Ia0))"); 795 assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3"); 796 recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "J", "K"); 797 assertLinkage("C", "C3", "J1", "K2", "C3"); 798 } 799 800 /* 801 * Cc3(Ac1(Id0), J(Id0)) -> Cc3(Ac1(Id0), Jd2(Id0)) 802 * 803 * 0: Declared in C (through bridge) 804 * 1: Declared in C (through bridge) 805 * 2*: Inherited default from J 806 * 3: Declared in C 807 */ 808 public void test56() throws IOException, ReflectiveOperationException { 809 compileSpec("Cc3(Ac1(Id0),J(Id0))"); 810 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 811 recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "J"); 812 assertLinkage("C", "C3", "C3", "J2", "C3"); 813 } 814 815 /* 816 * Cc3(Ac1(Ia0), J(Ia0)) -> Cc3(Ac1(Ia0), Jd2(Ia0)) 817 * 818 * 0: Declared in C (through bridge) 819 * 1: Declared in C (through bridge) 820 * 2*: Inherited default from J 821 * 3: Declared in C 822 */ 823 public void test57() throws IOException, ReflectiveOperationException { 824 compileSpec("Cc3(Ac1(Ia0),J(Ia0))"); 825 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 826 recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "J"); 827 assertLinkage("C", "C3", "C3", "J2", "C3"); 828 } 829 830 /* 831 * Cc3(Aa1(Id0), J(Id0)) -> Cc3(Aa1(Id0), Jd2(Id0)) 832 * 833 * 0: Declared in C (through bridge) 834 * 1: Declared in C (through bridge) 835 * 2*: Inherited default from J 836 * 3: Declared in C 837 */ 838 public void test58() throws IOException, ReflectiveOperationException { 839 compileSpec("Cc3(Aa1(Id0),J(Id0))"); 840 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 841 recompileSpec("Cc3(Aa1(Id0),Jd2(Id0))", "J"); 842 assertLinkage("C", "C3", "C3", "J2", "C3"); 843 } 844 845 /* 846 * Cc3(Aa1(Ia0), J(Ia0)) -> Cc3(Aa1(Ia0), Jd2(Ia0)) 847 * 848 * 0: Declared in C (through bridge) 849 * 1: Declared in C (through bridge) 850 * 2*: Inherited default from J 851 * 3: Declared in C 852 */ 853 public void test59() throws IOException, ReflectiveOperationException { 854 compileSpec("Cc3(Aa1(Ia0),J(Ia0))"); 855 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 856 recompileSpec("Cc3(Aa1(Ia0),Jd2(Ia0))", "J"); 857 assertLinkage("C", "C3", "C3", "J2", "C3"); 858 } 859 860 /* 861 * Cc3(A(Id0), Jd2(Id0)) -> Cc3(Ac1(Id0), Jd2(Id0)) 862 * 863 * 0: Declared in C (through bridge) 864 * 1*: Inherited from A 865 * 2: Declared in C (through bridge) 866 * 3: Declared in C 867 */ 868 public void test60() throws IOException, ReflectiveOperationException { 869 compileSpec("Cc3(A(Id0),Jd2(Id0))"); 870 assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3"); 871 recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A"); 872 assertLinkage("C", "C3", "A1", "C3", "C3"); 873 } 874 875 /* 876 * Cc3(A(Im0), Jd2(Ia0)) -> Cc3(Ac1(Im0), Jd2(Ia0)) 877 * 878 * 0: Declared in C (through bridge) 879 * 1*: Inherited from A 880 * 2: Declared in C (through bridge) 881 * 3: Declared in C 882 */ 883 public void test61() throws IOException, ReflectiveOperationException { 884 compileSpec("Cc3(A(Ia0),Jd2(Ia0))"); 885 assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3"); 886 recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A"); 887 assertLinkage("C", "C3", "A1", "C3", "C3"); 888 } 889 890 /* 891 * Cc3(A(Im0), Ja2(Id0)) -> Cc3(Ac1(Id0), Ja2(Id0)) 892 * 893 * 0: Declared in C (through bridge) 894 * 1*: Inherited from A 895 * 2: Declared in C (through bridge) 896 * 3: Declared in C 897 */ 898 public void test62() throws IOException, ReflectiveOperationException { 899 compileSpec("Cc3(A(Id0),Ja2(Id0))"); 900 assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3"); 901 recompileSpec("Cc3(Ac1(Id0),Ja2(Id0))", "A"); 902 assertLinkage("C", "C3", "A1", "C3", "C3"); 903 } 904 905 /* 906 * Cc3(A(Im0), Ja2(Ia0)) -> Cc3(Ac1(Ia0), Ja2(Ia0)) 907 * 908 * 0: Declared in C (through bridge) 909 * 1*: Inherited from A 910 * 2: Declared in C (through bridge) 911 * 3: Declared in C 912 */ 913 public void test63() throws IOException, ReflectiveOperationException { 914 compileSpec("Cc3(A(Ia0),Ja2(Ia0))"); 915 assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3"); 916 recompileSpec("Cc3(Ac1(Ia0),Ja2(Ia0))", "A"); 917 assertLinkage("C", "C3", "A1", "C3", "C3"); 918 } 919 920 /* 921 * Cc3(Jd1(Id0), K(Id0)) -> Cc3(Jd1(Id0), Kd2(Id0)) 922 * 923 * 0: Declared in C (through bridge) 924 * 1: Declared in C (through bridge) 925 * 2*: Inherited default from K 926 * 3: Declared in C 927 */ 928 public void test64() throws IOException, ReflectiveOperationException { 929 compileSpec("Cc3(Jd1(Id0),K(Id0))"); 930 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 931 recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K"); 932 assertLinkage("C", "C3", "C3", "K2", "C3"); 933 } 934 935 /* 936 * Cc3(Jd1(Ia0), K(Ia0)) -> Cc3(Jd1(Ia0), Kd2(Ia0)) 937 * 938 * 0: Declared in C (through bridge) 939 * 1: Declared in C (through bridge) 940 * 2*: Inherited default from K 941 * 3: Declared in C 942 */ 943 public void test65() throws IOException, ReflectiveOperationException { 944 compileSpec("Cc3(Jd1(Ia0),K(Ia0))"); 945 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 946 recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K"); 947 assertLinkage("C", "C3", "C3", "K2", "C3"); 948 } 949 950 /* 951 * Cc3(Ja1(Id0), K(Id0)) -> Cc3(Ja1(Id0), Kd2(Id0)) 952 * 953 * 0: Declared in C (through bridge) 954 * 1: Declared in C (through bridge) 955 * 2*: Inherited default from K 956 * 3: Declared in C 957 */ 958 public void test66() throws IOException, ReflectiveOperationException { 959 compileSpec("Cc3(Jd1(Id0),K(Id0))"); 960 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 961 recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K"); 962 assertLinkage("C", "C3", "C3", "K2", "C3"); 963 } 964 965 /* 966 * Cc3(Ja1(Ia0), K(Ia0)) -> Cc3(Ja1(Ia0), Kd2(Ia0)) 967 * 968 * 0: Declared in C (through bridge) 969 * 1: Declared in C (through bridge) 970 * 2*: Inherited default from K 971 * 3: Declared in C 972 */ 973 public void test67() throws IOException, ReflectiveOperationException { 974 compileSpec("Cc3(Jd1(Ia0),K(Ia0))"); 975 assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3"); 976 recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K"); 977 assertLinkage("C", "C3", "C3", "K2", "C3"); 978 } 979 980 // Dan's set A 981 public void testA1() throws IOException, ReflectiveOperationException { 982 compileSpec("C(Id0)"); 983 assertLinkage("C", "I0"); 984 } 985 986 public void testA2() throws IOException, ReflectiveOperationException { 987 compileSpec("C(A(Id0))"); 988 assertLinkage("C", "I0"); 989 } 990 991 public void testA3() throws IOException, ReflectiveOperationException { 992 compileSpec("C(A(Id0),J)"); 993 assertLinkage("C", "I0"); 994 } 995 996 public void testA4() throws IOException, ReflectiveOperationException { 997 compileSpec("D(C(Id0),Jd0(Id0))"); 998 assertLinkage("D", "J0"); 999 assertLinkage("C", "I0"); 1000 } 1001 1002 public void testA5() throws IOException, ReflectiveOperationException { 1003 compileSpec("C(A(Id0),Jd0)", 1004 "compiler.err.types.incompatible.unrelated.defaults"); 1005 } 1006 1007 public void testA6() throws IOException, ReflectiveOperationException { 1008 compileSpec("C(A(Ia0,Jd0))", 1009 "compiler.err.does.not.override.abstract", 1010 "compiler.err.types.incompatible.abstract.default"); 1011 } 1012 1013 public void testA7() throws IOException, ReflectiveOperationException { 1014 compileSpec("C(A(Id0,Jd0))", 1015 "compiler.err.types.incompatible.unrelated.defaults"); 1016 } 1017 1018 public void testA8() throws IOException, ReflectiveOperationException { 1019 compileSpec("C(A(Ia0),J)", "compiler.err.does.not.override.abstract"); 1020 } 1021 1022 public void testA9() throws IOException, ReflectiveOperationException { 1023 compileSpec("C(Ac0(Id0))"); 1024 assertLinkage("C", "A0"); 1025 } 1026 1027 public void testA10() throws IOException, ReflectiveOperationException { 1028 compileSpec("C(Aa0,I)", "compiler.err.does.not.override.abstract"); 1029 } 1030 1031 public void testA11() throws IOException, ReflectiveOperationException { 1032 compileSpec("C(Ac0,Id0)"); 1033 assertLinkage("C", "A0"); 1034 } 1035 1036 // Dan's set B 1037 1038 /* B1 can't be done, needs a second concrete class D 1039 public void testB1() throws IOException, ReflectiveOperationException { 1040 compileSpec("Cc1(Dc0)"); 1041 assertLinkage("C", "C1", "C1"); 1042 assertLinkage("D", "A0", LINKAGE_ERROR); 1043 } 1044 */ 1045 1046 public void testB2() throws IOException, ReflectiveOperationException { 1047 compileSpec("Cc1(Ac0)"); 1048 assertLinkage("C", "C1", "C1"); 1049 } 1050 1051 //??? B3 seems to suggest that we should create an abstract class 1052 //public void testB3() throws IOException, ReflectiveOperationException { 1053 // compileSpec("Ba1(Cc0)"); 1054 // assertLinkage("B", "C0", "A1"); 1055 //} 1056 1057 // B4 needs too many classes 1058 1059 public void testB5() throws IOException, ReflectiveOperationException { 1060 compileSpec("Cc1(Aa1(Id0))"); 1061 assertLinkage("C", "C1", "C1"); 1062 } 1063 1064 public void testB6() throws IOException, ReflectiveOperationException { 1065 compileSpec("C(Ac1(Id0))"); 1066 assertLinkage("C", "A1", "A1"); 1067 } 1068 1069 public void testB7() throws IOException, ReflectiveOperationException { 1070 compileSpec("Cc1(Id0)"); 1071 assertLinkage("C", "C1", "C1"); 1072 } 1073 1074 public void testB8() throws IOException, ReflectiveOperationException { 1075 compileSpec("C(Jd1(Id0))"); 1076 assertLinkage("C", "J1", "J1"); 1077 } 1078 1079 // B9 needs too many classes 1080 1081 // The rest of Dan's tests need generics 1082} 1083