|
Lines 365-374
Link Here
|
| 365 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
365 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
| 366 |
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); |
366 |
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); |
| 367 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
367 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 368 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
368 |
assertTrue("Should not be compatible", !DeltaProcessor.isCompatible(child)); |
| 369 |
} |
369 |
} |
| 370 |
|
370 |
|
| 371 |
/** |
371 |
/** |
|
|
372 |
* Addition of a field in an interface that cannot be extended |
| 373 |
*/ |
| 374 |
public void test30() { |
| 375 |
deployBundles("test30"); |
| 376 |
IApiBaseline before = getBeforeState(); |
| 377 |
IApiBaseline after = getAfterState(); |
| 378 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 379 |
assertNotNull("no api component", beforeApiComponent); |
| 380 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 381 |
assertNotNull("no api component", afterApiComponent); |
| 382 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 383 |
assertNotNull("No delta", delta); |
| 384 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 385 |
assertEquals("Wrong size", 1, allLeavesDeltas.length); |
| 386 |
IDelta child = allLeavesDeltas[0]; |
| 387 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 388 |
assertTrue("Not extend restrictions", RestrictionModifiers.isExtendRestriction(child.getRestrictions())); |
| 389 |
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); |
| 390 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 391 |
assertTrue("Should not be compatible", !DeltaProcessor.isCompatible(child)); |
| 392 |
} |
| 393 |
|
| 394 |
/** |
| 395 |
* Addition of a field in an interface that cannot be extended |
| 396 |
*/ |
| 397 |
public void test31() { |
| 398 |
deployBundles("test31"); |
| 399 |
IApiBaseline before = getBeforeState(); |
| 400 |
IApiBaseline after = getAfterState(); |
| 401 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 402 |
assertNotNull("no api component", beforeApiComponent); |
| 403 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 404 |
assertNotNull("no api component", afterApiComponent); |
| 405 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 406 |
assertNotNull("No delta", delta); |
| 407 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 408 |
assertEquals("Wrong size", 1, allLeavesDeltas.length); |
| 409 |
IDelta child = allLeavesDeltas[0]; |
| 410 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 411 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
| 412 |
assertEquals("Wrong flag", IDelta.FIELD, child.getFlags()); |
| 413 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 414 |
assertTrue("Should be compatible", DeltaProcessor.isCompatible(child)); |
| 415 |
} |
| 416 |
|
| 417 |
/** |
| 372 |
* Addition of a field in an interface that can be implemented |
418 |
* Addition of a field in an interface that can be implemented |
| 373 |
*/ |
419 |
*/ |
| 374 |
public void test15() { |
420 |
public void test15() { |
|
Lines 392-398
Link Here
|
| 392 |
} |
438 |
} |
| 393 |
|
439 |
|
| 394 |
/** |
440 |
/** |
| 395 |
* Move method up in hierarchy |
441 |
* Move method up in hierarchy with noimplement only |
| 396 |
*/ |
442 |
*/ |
| 397 |
public void test16() { |
443 |
public void test16() { |
| 398 |
deployBundles("test16"); |
444 |
deployBundles("test16"); |
|
Lines 411-417
Link Here
|
| 411 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
457 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
| 412 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
458 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 413 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
459 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
|
|
460 |
assertTrue("Method Add not compatible", !DeltaProcessor.isCompatible(child)); |
| 461 |
child = allLeavesDeltas[1]; |
| 462 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 463 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
| 464 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 465 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
| 466 |
} |
| 467 |
|
| 468 |
/** |
| 469 |
* Move method up in hierarchy with noextend only |
| 470 |
*/ |
| 471 |
public void test32() { |
| 472 |
deployBundles("test32"); |
| 473 |
IApiBaseline before = getBeforeState(); |
| 474 |
IApiBaseline after = getAfterState(); |
| 475 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 476 |
assertNotNull("no api component", beforeApiComponent); |
| 477 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 478 |
assertNotNull("no api component", afterApiComponent); |
| 479 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 480 |
assertNotNull("No delta", delta); |
| 481 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 482 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 483 |
IDelta child = allLeavesDeltas[0]; |
| 484 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 485 |
assertTrue("Not extend restrictions", RestrictionModifiers.isExtendRestriction(child.getRestrictions())); |
| 486 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 487 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 488 |
assertTrue("Method Add not compatible", !DeltaProcessor.isCompatible(child)); |
| 489 |
child = allLeavesDeltas[1]; |
| 490 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 491 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
| 492 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 414 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
493 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
|
|
494 |
} |
| 495 |
|
| 496 |
/** |
| 497 |
* Move method up in hierarchy with noextend and noimplement |
| 498 |
*/ |
| 499 |
public void test33() { |
| 500 |
deployBundles("test33"); |
| 501 |
IApiBaseline before = getBeforeState(); |
| 502 |
IApiBaseline after = getAfterState(); |
| 503 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 504 |
assertNotNull("no api component", beforeApiComponent); |
| 505 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 506 |
assertNotNull("no api component", afterApiComponent); |
| 507 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 508 |
assertNotNull("No delta", delta); |
| 509 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 510 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 511 |
IDelta child = allLeavesDeltas[0]; |
| 512 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 513 |
assertTrue("Not implement restrictions", RestrictionModifiers.isImplementRestriction(child.getRestrictions())); |
| 514 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 515 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 516 |
assertTrue("Method Add compatible", DeltaProcessor.isCompatible(child)); |
| 415 |
child = allLeavesDeltas[1]; |
517 |
child = allLeavesDeltas[1]; |
| 416 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
518 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 417 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
519 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
|
Lines 673-684
Link Here
|
| 673 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
775 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 674 |
assertEquals("Wrong flag", IDelta.SUPER_INTERFACE_WITH_METHODS, child.getFlags()); |
776 |
assertEquals("Wrong flag", IDelta.SUPER_INTERFACE_WITH_METHODS, child.getFlags()); |
| 675 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
777 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 676 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
778 |
assertTrue("Method Add not compatible", !DeltaProcessor.isCompatible(child)); |
| 677 |
child = allLeavesDeltas[1]; |
779 |
child = allLeavesDeltas[1]; |
| 678 |
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); |
780 |
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); |
| 679 |
assertEquals("Wrong flag", IDelta.EXPANDED_SUPERINTERFACES_SET, child.getFlags()); |
781 |
assertEquals("Wrong flag", IDelta.EXPANDED_SUPERINTERFACES_SET, child.getFlags()); |
| 680 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
782 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 681 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
783 |
assertTrue("Changed superinterfaces set not compatible", DeltaProcessor.isCompatible(child)); |
|
|
784 |
} |
| 785 |
/** |
| 786 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189 |
| 787 |
*/ |
| 788 |
public void test34() { |
| 789 |
deployBundles("test34"); |
| 790 |
IApiBaseline before = getBeforeState(); |
| 791 |
IApiBaseline after = getAfterState(); |
| 792 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 793 |
assertNotNull("no api component", beforeApiComponent); |
| 794 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 795 |
assertNotNull("no api component", afterApiComponent); |
| 796 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 797 |
assertNotNull("No delta", delta); |
| 798 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 799 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 800 |
IDelta child = allLeavesDeltas[0]; |
| 801 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 802 |
assertEquals("Wrong flag", IDelta.SUPER_INTERFACE_WITH_METHODS, child.getFlags()); |
| 803 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 804 |
assertTrue("Method Add not compatible", !DeltaProcessor.isCompatible(child)); |
| 805 |
child = allLeavesDeltas[1]; |
| 806 |
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); |
| 807 |
assertEquals("Wrong flag", IDelta.EXPANDED_SUPERINTERFACES_SET, child.getFlags()); |
| 808 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 809 |
assertTrue("Changed superinterfaces set not compatible", DeltaProcessor.isCompatible(child)); |
| 810 |
} |
| 811 |
/** |
| 812 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189 |
| 813 |
*/ |
| 814 |
public void test35() { |
| 815 |
deployBundles("test35"); |
| 816 |
IApiBaseline before = getBeforeState(); |
| 817 |
IApiBaseline after = getAfterState(); |
| 818 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 819 |
assertNotNull("no api component", beforeApiComponent); |
| 820 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 821 |
assertNotNull("no api component", afterApiComponent); |
| 822 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 823 |
assertNotNull("No delta", delta); |
| 824 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 825 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 826 |
IDelta child = allLeavesDeltas[0]; |
| 827 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 828 |
assertEquals("Wrong flag", IDelta.SUPER_INTERFACE_WITH_METHODS, child.getFlags()); |
| 829 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 830 |
assertTrue("Method Add compatible", DeltaProcessor.isCompatible(child)); |
| 831 |
child = allLeavesDeltas[1]; |
| 832 |
assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); |
| 833 |
assertEquals("Wrong flag", IDelta.EXPANDED_SUPERINTERFACES_SET, child.getFlags()); |
| 834 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 835 |
assertTrue("Changed superinterfaces set not compatible", DeltaProcessor.isCompatible(child)); |
| 682 |
} |
836 |
} |
| 683 |
/** |
837 |
/** |
| 684 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244984 |
838 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=244984 |
|
Lines 730-736
Link Here
|
| 730 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
884 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 731 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
885 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 732 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
886 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
|
|
887 |
assertTrue("Method Add compatible", !DeltaProcessor.isCompatible(child)); |
| 888 |
child = allLeavesDeltas[1]; |
| 889 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 890 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
| 891 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 892 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
| 893 |
} |
| 894 |
/** |
| 895 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189 |
| 896 |
*/ |
| 897 |
public void test36() { |
| 898 |
deployBundles("test36"); |
| 899 |
IApiBaseline before = getBeforeState(); |
| 900 |
IApiBaseline after = getAfterState(); |
| 901 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 902 |
assertNotNull("no api component", beforeApiComponent); |
| 903 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 904 |
assertNotNull("no api component", afterApiComponent); |
| 905 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 906 |
assertNotNull("No delta", delta); |
| 907 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 908 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 909 |
IDelta child = allLeavesDeltas[0]; |
| 910 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 911 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 912 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 913 |
assertTrue("Method Add compatible", !DeltaProcessor.isCompatible(child)); |
| 914 |
child = allLeavesDeltas[1]; |
| 915 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 916 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
| 917 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 733 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
918 |
assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); |
|
|
919 |
} |
| 920 |
/** |
| 921 |
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=230189 |
| 922 |
*/ |
| 923 |
public void test37() { |
| 924 |
deployBundles("test37"); |
| 925 |
IApiBaseline before = getBeforeState(); |
| 926 |
IApiBaseline after = getAfterState(); |
| 927 |
IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); |
| 928 |
assertNotNull("no api component", beforeApiComponent); |
| 929 |
IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); |
| 930 |
assertNotNull("no api component", afterApiComponent); |
| 931 |
IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after); |
| 932 |
assertNotNull("No delta", delta); |
| 933 |
IDelta[] allLeavesDeltas = collectLeaves(delta); |
| 934 |
assertEquals("Wrong size", 2, allLeavesDeltas.length); |
| 935 |
IDelta child = allLeavesDeltas[0]; |
| 936 |
assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); |
| 937 |
assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); |
| 938 |
assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); |
| 939 |
assertTrue("Method Add not compatible", DeltaProcessor.isCompatible(child)); |
| 734 |
child = allLeavesDeltas[1]; |
940 |
child = allLeavesDeltas[1]; |
| 735 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
941 |
assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); |
| 736 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |
942 |
assertEquals("Wrong flag", IDelta.METHOD_MOVED_UP, child.getFlags()); |