1 /******************************************************************************* 2 * Copyright (c) 2007, 2019 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.pde.api.tools.comparator.tests; 15 16 import static org.junit.Assert.assertEquals; 17 import static org.junit.Assert.assertFalse; 18 import static org.junit.Assert.assertNotNull; 19 import static org.junit.Assert.assertTrue; 20 21 import org.eclipse.jdt.core.Flags; 22 import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers; 23 import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers; 24 import org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator; 25 import org.eclipse.pde.api.tools.internal.provisional.comparator.DeltaProcessor; 26 import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta; 27 import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline; 28 import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent; 29 import org.eclipse.pde.api.tools.internal.util.Util; 30 import org.junit.Test; 31 32 /** 33 * Delta tests for method 34 */ 35 public class MethodDeltaTests extends DeltaTestSetup { 36 37 @Override getTestRoot()38 public String getTestRoot() { 39 return "method"; //$NON-NLS-1$ 40 } 41 42 /** 43 * Change method body 44 */ 45 @Test test1()46 public void test1() { 47 deployBundles("test1"); //$NON-NLS-1$ 48 IApiBaseline before = getBeforeState(); 49 IApiBaseline after = getAfterState(); 50 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 51 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 52 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 53 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 54 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 55 assertNotNull("No delta", delta); //$NON-NLS-1$ 56 assertTrue("Not empty", delta.isEmpty()); //$NON-NLS-1$ 57 assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 58 } 59 60 /** 61 * rename method parameter 62 */ 63 @Test test2()64 public void test2() { 65 deployBundles("test2"); //$NON-NLS-1$ 66 IApiBaseline before = getBeforeState(); 67 IApiBaseline after = getAfterState(); 68 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 69 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 70 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 71 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 72 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 73 assertNotNull("No delta", delta); //$NON-NLS-1$ 74 assertTrue("Not empty", delta.isEmpty()); //$NON-NLS-1$ 75 assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 76 } 77 78 /** 79 * Change method name 80 */ 81 @Test test3()82 public void test3() { 83 deployBundles("test3"); //$NON-NLS-1$ 84 IApiBaseline before = getBeforeState(); 85 IApiBaseline after = getAfterState(); 86 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 87 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 88 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 89 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 90 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 91 assertNotNull("No delta", delta); //$NON-NLS-1$ 92 IDelta[] allLeavesDeltas = collectLeaves(delta); 93 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 94 IDelta child = allLeavesDeltas[0]; 95 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 96 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 97 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 98 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 99 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 100 child = allLeavesDeltas[1]; 101 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 102 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 103 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 104 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 105 } 106 107 /** 108 * Add formal parameter 109 */ 110 @Test test4()111 public void test4() { 112 deployBundles("test4"); //$NON-NLS-1$ 113 IApiBaseline before = getBeforeState(); 114 IApiBaseline after = getAfterState(); 115 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 116 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 117 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 118 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 119 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 120 assertNotNull("No delta", delta); //$NON-NLS-1$ 121 IDelta[] allLeavesDeltas = collectLeaves(delta); 122 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 123 IDelta child = allLeavesDeltas[0]; 124 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 125 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 126 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 127 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 128 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 129 child = allLeavesDeltas[1]; 130 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 131 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 132 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 133 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 134 } 135 136 /** 137 * Delete formal parameter 138 */ 139 @Test test5()140 public void test5() { 141 deployBundles("test5"); //$NON-NLS-1$ 142 IApiBaseline before = getBeforeState(); 143 IApiBaseline after = getAfterState(); 144 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 145 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 146 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 147 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 148 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 149 assertNotNull("No delta", delta); //$NON-NLS-1$ 150 IDelta[] allLeavesDeltas = collectLeaves(delta); 151 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 152 IDelta child = allLeavesDeltas[0]; 153 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 154 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 155 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 156 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 157 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 158 child = allLeavesDeltas[1]; 159 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 160 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 161 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 162 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 163 } 164 165 /** 166 * Change type of formal parameter 167 */ 168 @Test test6()169 public void test6() { 170 deployBundles("test6"); //$NON-NLS-1$ 171 IApiBaseline before = getBeforeState(); 172 IApiBaseline after = getAfterState(); 173 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 174 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 175 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 176 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 177 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 178 assertNotNull("No delta", delta); //$NON-NLS-1$ 179 IDelta[] allLeavesDeltas = collectLeaves(delta); 180 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 181 IDelta child = allLeavesDeltas[0]; 182 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 183 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 184 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 185 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 186 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 187 child = allLeavesDeltas[1]; 188 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 189 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 190 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 191 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 192 } 193 194 /** 195 * Change result type 196 */ 197 @Test test7()198 public void test7() { 199 deployBundles("test7"); //$NON-NLS-1$ 200 IApiBaseline before = getBeforeState(); 201 IApiBaseline after = getAfterState(); 202 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 203 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 204 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 205 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 206 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 207 assertNotNull("No delta", delta); //$NON-NLS-1$ 208 IDelta[] allLeavesDeltas = collectLeaves(delta); 209 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 210 IDelta child = allLeavesDeltas[0]; 211 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 212 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 213 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 214 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 215 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 216 child = allLeavesDeltas[1]; 217 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 218 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 219 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 220 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 221 } 222 223 /** 224 * Add checked exception 225 */ 226 @Test test8()227 public void test8() { 228 deployBundles("test8"); //$NON-NLS-1$ 229 IApiBaseline before = getBeforeState(); 230 IApiBaseline after = getAfterState(); 231 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 232 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 233 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 234 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 235 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 236 assertNotNull("No delta", delta); //$NON-NLS-1$ 237 IDelta[] allLeavesDeltas = collectLeaves(delta); 238 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 239 IDelta child = allLeavesDeltas[0]; 240 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 241 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 242 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 243 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 244 } 245 246 /** 247 * Add unchecked exception 248 */ 249 @Test test9()250 public void test9() { 251 deployBundles("test9"); //$NON-NLS-1$ 252 IApiBaseline before = getBeforeState(); 253 IApiBaseline after = getAfterState(); 254 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 255 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 256 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 257 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 258 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 259 assertNotNull("No delta", delta); //$NON-NLS-1$ 260 IDelta[] allLeavesDeltas = collectLeaves(delta); 261 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 262 IDelta child = allLeavesDeltas[0]; 263 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 264 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 265 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 266 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 267 } 268 269 /** 270 * Remove checked exception 271 */ 272 @Test test10()273 public void test10() { 274 deployBundles("test10"); //$NON-NLS-1$ 275 IApiBaseline before = getBeforeState(); 276 IApiBaseline after = getAfterState(); 277 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 278 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 279 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 280 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 281 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 282 assertNotNull("No delta", delta); //$NON-NLS-1$ 283 IDelta[] allLeavesDeltas = collectLeaves(delta); 284 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 285 IDelta child = allLeavesDeltas[0]; 286 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 287 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 288 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 289 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 290 } 291 292 /** 293 * Remove unchecked exception 294 */ 295 @Test test11()296 public void test11() { 297 deployBundles("test11"); //$NON-NLS-1$ 298 IApiBaseline before = getBeforeState(); 299 IApiBaseline after = getAfterState(); 300 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 301 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 302 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 303 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 304 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 305 assertNotNull("No delta", delta); //$NON-NLS-1$ 306 IDelta[] allLeavesDeltas = collectLeaves(delta); 307 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 308 IDelta child = allLeavesDeltas[0]; 309 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 310 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 311 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 312 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 313 } 314 315 /** 316 * Reorder list of thrown exceptions 317 */ 318 @Test test12()319 public void test12() { 320 deployBundles("test12"); //$NON-NLS-1$ 321 IApiBaseline before = getBeforeState(); 322 IApiBaseline after = getAfterState(); 323 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 324 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 325 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 326 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 327 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 328 assertNotNull("No delta", delta); //$NON-NLS-1$ 329 assertTrue("Not empty", delta.isEmpty()); //$NON-NLS-1$ 330 assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 331 } 332 333 /** 334 * Decrease visibility 335 */ 336 @Test test13()337 public void test13() { 338 deployBundles("test13"); //$NON-NLS-1$ 339 IApiBaseline before = getBeforeState(); 340 IApiBaseline after = getAfterState(); 341 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 342 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 343 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 344 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 345 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 346 assertNotNull("No delta", delta); //$NON-NLS-1$ 347 IDelta[] allLeavesDeltas = collectLeaves(delta); 348 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 349 IDelta child = allLeavesDeltas[0]; 350 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 351 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 352 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 353 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 354 } 355 356 /** 357 * Decrease visibility 358 */ 359 @Test test14()360 public void test14() { 361 deployBundles("test14"); //$NON-NLS-1$ 362 IApiBaseline before = getBeforeState(); 363 IApiBaseline after = getAfterState(); 364 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 365 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 366 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 367 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 368 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 369 assertNotNull("No delta", delta); //$NON-NLS-1$ 370 IDelta[] allLeavesDeltas = collectLeaves(delta); 371 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 372 IDelta child = allLeavesDeltas[0]; 373 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 374 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 375 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 376 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 377 } 378 379 /** 380 * Decrease visibility 381 */ 382 @Test test15()383 public void test15() { 384 deployBundles("test15"); //$NON-NLS-1$ 385 IApiBaseline before = getBeforeState(); 386 IApiBaseline after = getAfterState(); 387 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 388 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 389 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 390 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 391 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 392 assertNotNull("No delta", delta); //$NON-NLS-1$ 393 IDelta[] allLeavesDeltas = collectLeaves(delta); 394 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 395 IDelta child = allLeavesDeltas[0]; 396 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 397 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 398 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 399 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 400 } 401 402 /** 403 * Decrease visibility 404 */ 405 @Test test16()406 public void test16() { 407 deployBundles("test16"); //$NON-NLS-1$ 408 IApiBaseline before = getBeforeState(); 409 IApiBaseline after = getAfterState(); 410 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 411 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 412 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 413 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 414 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 415 assertNotNull("No delta", delta); //$NON-NLS-1$ 416 IDelta[] allLeavesDeltas = collectLeaves(delta); 417 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 418 IDelta child = allLeavesDeltas[0]; 419 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 420 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 421 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 422 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 423 } 424 425 /** 426 * Decrease visibility 427 */ 428 @Test test17()429 public void test17() { 430 deployBundles("test17"); //$NON-NLS-1$ 431 IApiBaseline before = getBeforeState(); 432 IApiBaseline after = getAfterState(); 433 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 434 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 435 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 436 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 437 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 438 assertNotNull("No delta", delta); //$NON-NLS-1$ 439 IDelta[] allLeavesDeltas = collectLeaves(delta); 440 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 441 IDelta child = allLeavesDeltas[0]; 442 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 443 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 444 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 445 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 446 } 447 448 /** 449 * Increase visibility 450 */ 451 @Test test18()452 public void test18() { 453 deployBundles("test18"); //$NON-NLS-1$ 454 IApiBaseline before = getBeforeState(); 455 IApiBaseline after = getAfterState(); 456 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 457 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 458 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 459 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 460 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 461 assertNotNull("No delta", delta); //$NON-NLS-1$ 462 IDelta[] allLeavesDeltas = collectLeaves(delta); 463 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 464 IDelta child = allLeavesDeltas[0]; 465 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 466 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 467 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 468 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 469 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 470 } 471 472 /** 473 * Increase visibility 474 */ 475 @Test test19()476 public void test19() { 477 deployBundles("test19"); //$NON-NLS-1$ 478 IApiBaseline before = getBeforeState(); 479 IApiBaseline after = getAfterState(); 480 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 481 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 482 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 483 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 484 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 485 assertNotNull("No delta", delta); //$NON-NLS-1$ 486 IDelta[] allLeavesDeltas = collectLeaves(delta); 487 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 488 IDelta child = allLeavesDeltas[0]; 489 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 490 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 491 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 492 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 493 } 494 495 /** 496 * Increase visibility 497 */ 498 @Test test20()499 public void test20() { 500 deployBundles("test20"); //$NON-NLS-1$ 501 IApiBaseline before = getBeforeState(); 502 IApiBaseline after = getAfterState(); 503 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 504 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 505 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 506 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 507 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 508 assertNotNull("No delta", delta); //$NON-NLS-1$ 509 IDelta[] allLeavesDeltas = collectLeaves(delta); 510 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 511 IDelta child = allLeavesDeltas[0]; 512 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 513 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 514 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 515 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 516 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 517 } 518 519 /** 520 * Abstract to non-abstract 521 */ 522 @Test test21()523 public void test21() { 524 deployBundles("test21"); //$NON-NLS-1$ 525 IApiBaseline before = getBeforeState(); 526 IApiBaseline after = getAfterState(); 527 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 528 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 529 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 530 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 531 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 532 assertNotNull("No delta", delta); //$NON-NLS-1$ 533 IDelta[] allLeavesDeltas = collectLeaves(delta); 534 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 535 IDelta child = allLeavesDeltas[0]; 536 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 537 assertEquals("Wrong flag", IDelta.ABSTRACT_TO_NON_ABSTRACT, child.getFlags()); //$NON-NLS-1$ 538 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 539 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 540 } 541 542 /** 543 * non-abstract to abstract 544 */ 545 @Test test22()546 public void test22() { 547 deployBundles("test22"); //$NON-NLS-1$ 548 IApiBaseline before = getBeforeState(); 549 IApiBaseline after = getAfterState(); 550 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 551 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 552 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 553 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 554 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 555 assertNotNull("No delta", delta); //$NON-NLS-1$ 556 IDelta[] allLeavesDeltas = collectLeaves(delta); 557 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 558 IDelta child = allLeavesDeltas[0]; 559 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 560 assertEquals("Wrong flag", IDelta.NON_ABSTRACT_TO_ABSTRACT, child.getFlags()); //$NON-NLS-1$ 561 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 562 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 563 } 564 565 /** 566 * final to non-final 567 */ 568 @Test test23()569 public void test23() { 570 deployBundles("test23"); //$NON-NLS-1$ 571 IApiBaseline before = getBeforeState(); 572 IApiBaseline after = getAfterState(); 573 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 574 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 575 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 576 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 577 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 578 assertNotNull("No delta", delta); //$NON-NLS-1$ 579 IDelta[] allLeavesDeltas = collectLeaves(delta); 580 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 581 IDelta child = allLeavesDeltas[0]; 582 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 583 assertEquals("Wrong flag", IDelta.FINAL_TO_NON_FINAL, child.getFlags()); //$NON-NLS-1$ 584 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 585 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 586 } 587 588 /** 589 * non-final to final 590 */ 591 @Test test24()592 public void test24() { 593 deployBundles("test24"); //$NON-NLS-1$ 594 IApiBaseline before = getBeforeState(); 595 IApiBaseline after = getAfterState(); 596 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 597 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 598 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 599 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 600 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 601 assertNotNull("No delta", delta); //$NON-NLS-1$ 602 IDelta[] allLeavesDeltas = collectLeaves(delta); 603 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 604 IDelta child = allLeavesDeltas[0]; 605 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 606 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 607 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 608 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 609 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 610 } 611 612 /** 613 * static to non-static 614 */ 615 @Test test25()616 public void test25() { 617 deployBundles("test25"); //$NON-NLS-1$ 618 IApiBaseline before = getBeforeState(); 619 IApiBaseline after = getAfterState(); 620 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 621 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 622 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 623 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 624 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 625 assertNotNull("No delta", delta); //$NON-NLS-1$ 626 IDelta[] allLeavesDeltas = collectLeaves(delta); 627 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 628 IDelta child = allLeavesDeltas[0]; 629 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 630 assertEquals("Wrong flag", IDelta.STATIC_TO_NON_STATIC, child.getFlags()); //$NON-NLS-1$ 631 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 632 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 633 } 634 635 /** 636 * non-static to static 637 */ 638 @Test test26()639 public void test26() { 640 deployBundles("test26"); //$NON-NLS-1$ 641 IApiBaseline before = getBeforeState(); 642 IApiBaseline after = getAfterState(); 643 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 644 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 645 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 646 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 647 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 648 assertNotNull("No delta", delta); //$NON-NLS-1$ 649 IDelta[] allLeavesDeltas = collectLeaves(delta); 650 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 651 IDelta child = allLeavesDeltas[0]; 652 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 653 assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 654 assertTrue("Was visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 655 assertEquals("Wrong flag", IDelta.NON_STATIC_TO_STATIC, child.getFlags()); //$NON-NLS-1$ 656 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 657 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 658 } 659 660 /** 661 * native to non-native 662 */ 663 @Test test27()664 public void test27() { 665 deployBundles("test27"); //$NON-NLS-1$ 666 IApiBaseline before = getBeforeState(); 667 IApiBaseline after = getAfterState(); 668 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 669 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 670 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 671 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 672 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 673 assertNotNull("No delta", delta); //$NON-NLS-1$ 674 IDelta[] allLeavesDeltas = collectLeaves(delta); 675 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 676 IDelta child = allLeavesDeltas[0]; 677 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 678 assertEquals("Wrong flag", IDelta.NATIVE_TO_NON_NATIVE, child.getFlags()); //$NON-NLS-1$ 679 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 680 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 681 } 682 683 /** 684 * non-native to native 685 */ 686 @Test test28()687 public void test28() { 688 deployBundles("test28"); //$NON-NLS-1$ 689 IApiBaseline before = getBeforeState(); 690 IApiBaseline after = getAfterState(); 691 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 692 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 693 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 694 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 695 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 696 assertNotNull("No delta", delta); //$NON-NLS-1$ 697 IDelta[] allLeavesDeltas = collectLeaves(delta); 698 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 699 IDelta child = allLeavesDeltas[0]; 700 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 701 assertEquals("Wrong flag", IDelta.NON_NATIVE_TO_NATIVE, child.getFlags()); //$NON-NLS-1$ 702 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 703 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 704 } 705 706 /** 707 * synchronized to non-synchronized 708 */ 709 @Test test29()710 public void test29() { 711 deployBundles("test29"); //$NON-NLS-1$ 712 IApiBaseline before = getBeforeState(); 713 IApiBaseline after = getAfterState(); 714 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 715 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 716 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 717 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 718 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 719 assertNotNull("No delta", delta); //$NON-NLS-1$ 720 IDelta[] allLeavesDeltas = collectLeaves(delta); 721 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 722 IDelta child = allLeavesDeltas[0]; 723 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 724 assertEquals("Wrong flag", IDelta.SYNCHRONIZED_TO_NON_SYNCHRONIZED, child.getFlags()); //$NON-NLS-1$ 725 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 726 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 727 } 728 729 /** 730 * non-synchronized to synchronized 731 */ 732 @Test test30()733 public void test30() { 734 deployBundles("test30"); //$NON-NLS-1$ 735 IApiBaseline before = getBeforeState(); 736 IApiBaseline after = getAfterState(); 737 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 738 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 739 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 740 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 741 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 742 assertNotNull("No delta", delta); //$NON-NLS-1$ 743 IDelta[] allLeavesDeltas = collectLeaves(delta); 744 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 745 IDelta child = allLeavesDeltas[0]; 746 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 747 assertEquals("Wrong flag", IDelta.NON_SYNCHRONIZED_TO_SYNCHRONIZED, child.getFlags()); //$NON-NLS-1$ 748 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 749 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 750 } 751 752 /** 753 * Add new type parameter 754 */ 755 @Test test31()756 public void test31() { 757 deployBundles("test31"); //$NON-NLS-1$ 758 IApiBaseline before = getBeforeState(); 759 IApiBaseline after = getAfterState(); 760 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 761 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 762 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 763 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 764 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 765 assertNotNull("No delta", delta); //$NON-NLS-1$ 766 IDelta[] allLeavesDeltas = collectLeaves(delta); 767 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 768 IDelta child = allLeavesDeltas[0]; 769 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 770 assertEquals("Wrong flag", IDelta.TYPE_PARAMETERS, child.getFlags()); //$NON-NLS-1$ 771 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 772 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 773 } 774 775 /** 776 * Add new type parameter to a method that did not have a type parameter but 777 * that had a generic signature. 778 */ 779 @Test test31a()780 public void test31a() { 781 deployBundles("test31a"); //$NON-NLS-1$ 782 IApiBaseline before = getBeforeState(); 783 IApiBaseline after = getAfterState(); 784 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 785 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 786 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 787 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 788 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 789 assertNotNull("No delta", delta); //$NON-NLS-1$ 790 IDelta[] allLeavesDeltas = collectLeaves(delta); 791 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 792 IDelta child = allLeavesDeltas[0]; 793 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 794 assertEquals("Wrong flag", IDelta.TYPE_PARAMETERS, child.getFlags()); //$NON-NLS-1$ 795 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 796 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 797 assertEquals("foo<U:Ljava/lang/Number;>(TU;Ljava/util/List<TU;>;)V", child.getKey()); //$NON-NLS-1$ 798 } 799 800 /** 801 * Add another type parameter 802 */ 803 @Test test32()804 public void test32() { 805 deployBundles("test32"); //$NON-NLS-1$ 806 IApiBaseline before = getBeforeState(); 807 IApiBaseline after = getAfterState(); 808 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 809 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 810 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 811 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 812 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 813 assertNotNull("No delta", delta); //$NON-NLS-1$ 814 IDelta[] allLeavesDeltas = collectLeaves(delta); 815 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 816 IDelta child = allLeavesDeltas[0]; 817 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 818 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER, child.getFlags()); //$NON-NLS-1$ 819 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 820 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 821 assertEquals("foo<U:Ljava/lang/Object;V:Ljava/lang/Object;>(TU;)V", child.getKey()); //$NON-NLS-1$ 822 } 823 824 /** 825 * Delete type parameters 826 */ 827 @Test test33()828 public void test33() { 829 deployBundles("test33"); //$NON-NLS-1$ 830 IApiBaseline before = getBeforeState(); 831 IApiBaseline after = getAfterState(); 832 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 833 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 834 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 835 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 836 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 837 assertNotNull("No delta", delta); //$NON-NLS-1$ 838 IDelta[] allLeavesDeltas = collectLeaves(delta); 839 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 840 IDelta child = allLeavesDeltas[0]; 841 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 842 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER, child.getFlags()); //$NON-NLS-1$ 843 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 844 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 845 } 846 847 /** 848 * Delete type parameter 849 */ 850 @Test test34()851 public void test34() { 852 deployBundles("test34"); //$NON-NLS-1$ 853 IApiBaseline before = getBeforeState(); 854 IApiBaseline after = getAfterState(); 855 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 856 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 857 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 858 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 859 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 860 assertNotNull("No delta", delta); //$NON-NLS-1$ 861 IDelta[] allLeavesDeltas = collectLeaves(delta); 862 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 863 IDelta child = allLeavesDeltas[0]; 864 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 865 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER, child.getFlags()); //$NON-NLS-1$ 866 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 867 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 868 } 869 870 /** 871 * Rename type parameter 872 */ 873 @Test test35()874 public void test35() { 875 deployBundles("test35"); //$NON-NLS-1$ 876 IApiBaseline before = getBeforeState(); 877 IApiBaseline after = getAfterState(); 878 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 879 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 880 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 881 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 882 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 883 assertNotNull("No delta", delta); //$NON-NLS-1$ 884 IDelta[] allLeavesDeltas = collectLeaves(delta); 885 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 886 IDelta child = allLeavesDeltas[0]; 887 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 888 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER_NAME, child.getFlags()); //$NON-NLS-1$ 889 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 890 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 891 } 892 893 /** 894 * Reorder type parameters + changed class bound and interface bound 895 */ 896 @Test test36()897 public void test36() { 898 deployBundles("test36"); //$NON-NLS-1$ 899 IApiBaseline before = getBeforeState(); 900 IApiBaseline after = getAfterState(); 901 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 902 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 903 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 904 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 905 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 906 assertNotNull("No delta", delta); //$NON-NLS-1$ 907 IDelta[] allLeavesDeltas = collectLeaves(delta); 908 assertEquals("Wrong size", 6, allLeavesDeltas.length); //$NON-NLS-1$ 909 IDelta child = allLeavesDeltas[0]; 910 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 911 assertEquals("Wrong flag", IDelta.CLASS_BOUND, child.getFlags()); //$NON-NLS-1$ 912 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 913 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 914 child = allLeavesDeltas[1]; 915 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 916 assertEquals("Wrong flag", IDelta.INTERFACE_BOUND, child.getFlags()); //$NON-NLS-1$ 917 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 918 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 919 child = allLeavesDeltas[2]; 920 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 921 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER_NAME, child.getFlags()); //$NON-NLS-1$ 922 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 923 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 924 child = allLeavesDeltas[3]; 925 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 926 assertEquals("Wrong flag", IDelta.TYPE_PARAMETER_NAME, child.getFlags()); //$NON-NLS-1$ 927 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 928 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 929 child = allLeavesDeltas[4]; 930 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 931 assertEquals("Wrong flag", IDelta.CLASS_BOUND, child.getFlags()); //$NON-NLS-1$ 932 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 933 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 934 child = allLeavesDeltas[5]; 935 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 936 assertEquals("Wrong flag", IDelta.INTERFACE_BOUND, child.getFlags()); //$NON-NLS-1$ 937 assertEquals("Wrong element type", IDelta.TYPE_PARAMETER_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 938 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 939 } 940 941 /** 942 * Change last parameter from array to varargs 943 */ 944 @Test test37()945 public void test37() { 946 deployBundles("test37"); //$NON-NLS-1$ 947 IApiBaseline before = getBeforeState(); 948 IApiBaseline after = getAfterState(); 949 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 950 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 951 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 952 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 953 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 954 assertNotNull("No delta", delta); //$NON-NLS-1$ 955 IDelta[] allLeavesDeltas = collectLeaves(delta); 956 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 957 IDelta child = allLeavesDeltas[0]; 958 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 959 assertEquals("Wrong flag", IDelta.ARRAY_TO_VARARGS, child.getFlags()); //$NON-NLS-1$ 960 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 961 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 962 } 963 964 /** 965 * Change last parameter from varargs to array 966 */ 967 @Test test38()968 public void test38() { 969 deployBundles("test38"); //$NON-NLS-1$ 970 IApiBaseline before = getBeforeState(); 971 IApiBaseline after = getAfterState(); 972 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 973 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 974 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 975 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 976 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 977 assertNotNull("No delta", delta); //$NON-NLS-1$ 978 IDelta[] allLeavesDeltas = collectLeaves(delta); 979 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 980 IDelta child = allLeavesDeltas[0]; 981 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 982 assertEquals("Wrong flag", IDelta.VARARGS_TO_ARRAY, child.getFlags()); //$NON-NLS-1$ 983 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 984 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 985 } 986 987 /** 988 * Removed unchecked exception 989 */ 990 @Test test39()991 public void test39() { 992 deployBundles("test39"); //$NON-NLS-1$ 993 IApiBaseline before = getBeforeState(); 994 IApiBaseline after = getAfterState(); 995 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 996 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 997 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 998 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 999 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1000 assertNotNull("No delta", delta); //$NON-NLS-1$ 1001 IDelta[] allLeavesDeltas = collectLeaves(delta); 1002 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1003 IDelta child = allLeavesDeltas[0]; 1004 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1005 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 1006 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1007 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1008 } 1009 1010 /** 1011 * Removed checked exception 1012 */ 1013 @Test test40()1014 public void test40() { 1015 deployBundles("test40"); //$NON-NLS-1$ 1016 IApiBaseline before = getBeforeState(); 1017 IApiBaseline after = getAfterState(); 1018 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1019 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1020 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1021 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1022 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1023 assertNotNull("No delta", delta); //$NON-NLS-1$ 1024 IDelta[] allLeavesDeltas = collectLeaves(delta); 1025 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1026 IDelta child = allLeavesDeltas[0]; 1027 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1028 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 1029 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1030 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1031 } 1032 1033 /** 1034 * Add checked exception 1035 */ 1036 @Test test41()1037 public void test41() { 1038 deployBundles("test41"); //$NON-NLS-1$ 1039 IApiBaseline before = getBeforeState(); 1040 IApiBaseline after = getAfterState(); 1041 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1042 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1043 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1044 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1045 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1046 assertNotNull("No delta", delta); //$NON-NLS-1$ 1047 IDelta[] allLeavesDeltas = collectLeaves(delta); 1048 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1049 IDelta child = allLeavesDeltas[0]; 1050 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1051 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 1052 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1053 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1054 } 1055 1056 /** 1057 * Added unchecked exception 1058 */ 1059 @Test test42()1060 public void test42() { 1061 deployBundles("test42"); //$NON-NLS-1$ 1062 IApiBaseline before = getBeforeState(); 1063 IApiBaseline after = getAfterState(); 1064 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1065 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1066 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1067 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1068 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1069 assertNotNull("No delta", delta); //$NON-NLS-1$ 1070 IDelta[] allLeavesDeltas = collectLeaves(delta); 1071 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1072 IDelta child = allLeavesDeltas[0]; 1073 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1074 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 1075 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1076 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1077 } 1078 1079 /** 1080 * Added default value 1081 */ 1082 @Test test43()1083 public void test43() { 1084 deployBundles("test43"); //$NON-NLS-1$ 1085 IApiBaseline before = getBeforeState(); 1086 IApiBaseline after = getAfterState(); 1087 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1088 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1089 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1090 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1091 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1092 assertNotNull("No delta", delta); //$NON-NLS-1$ 1093 IDelta[] allLeavesDeltas = collectLeaves(delta); 1094 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1095 IDelta child = allLeavesDeltas[0]; 1096 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1097 assertEquals("Wrong flag", IDelta.ANNOTATION_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1098 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1099 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1100 } 1101 1102 /** 1103 * Removed default value 1104 */ 1105 @Test test44()1106 public void test44() { 1107 deployBundles("test44"); //$NON-NLS-1$ 1108 IApiBaseline before = getBeforeState(); 1109 IApiBaseline after = getAfterState(); 1110 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1111 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1112 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1113 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1114 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1115 assertNotNull("No delta", delta); //$NON-NLS-1$ 1116 IDelta[] allLeavesDeltas = collectLeaves(delta); 1117 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1118 IDelta child = allLeavesDeltas[0]; 1119 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1120 assertEquals("Wrong flag", IDelta.ANNOTATION_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1121 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1122 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1123 } 1124 1125 /** 1126 * Changed default value 1127 */ 1128 @Test test45()1129 public void test45() { 1130 deployBundles("test45"); //$NON-NLS-1$ 1131 IApiBaseline before = getBeforeState(); 1132 IApiBaseline after = getAfterState(); 1133 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1134 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1135 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1136 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1137 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1138 assertNotNull("No delta", delta); //$NON-NLS-1$ 1139 IDelta[] allLeavesDeltas = collectLeaves(delta); 1140 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1141 IDelta child = allLeavesDeltas[0]; 1142 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1143 assertEquals("Wrong flag", IDelta.ANNOTATION_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1144 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1145 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1146 } 1147 1148 /** 1149 * non-final to final 1150 */ 1151 @Test test46()1152 public void test46() { 1153 deployBundles("test46"); //$NON-NLS-1$ 1154 IApiBaseline before = getBeforeState(); 1155 IApiBaseline after = getAfterState(); 1156 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1157 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1158 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1159 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1160 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1161 assertNotNull("No delta", delta); //$NON-NLS-1$ 1162 IDelta[] allLeavesDeltas = collectLeaves(delta); 1163 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1164 IDelta child = allLeavesDeltas[0]; 1165 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1166 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 1167 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1168 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1169 } 1170 1171 /** 1172 * change return type of a package visible method 1173 */ 1174 @Test test47()1175 public void test47() { 1176 deployBundles("test47"); //$NON-NLS-1$ 1177 IApiBaseline before = getBeforeState(); 1178 IApiBaseline after = getAfterState(); 1179 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1180 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1181 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1182 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1183 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1184 assertNotNull("No delta", delta); //$NON-NLS-1$ 1185 IDelta[] allLeavesDeltas = collectLeaves(delta); 1186 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 1187 IDelta child = allLeavesDeltas[0]; 1188 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1189 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1190 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1191 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1192 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1193 child = allLeavesDeltas[1]; 1194 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1195 assertFalse("Is visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1196 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1197 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1198 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1199 } 1200 1201 /** 1202 * Add checked exception 1203 */ 1204 @Test test48()1205 public void test48() { 1206 deployBundles("test48"); //$NON-NLS-1$ 1207 IApiBaseline before = getBeforeState(); 1208 IApiBaseline after = getAfterState(); 1209 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1210 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1211 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1212 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1213 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1214 assertNotNull("No delta", delta); //$NON-NLS-1$ 1215 IDelta[] allLeavesDeltas = collectLeaves(delta); 1216 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1217 IDelta child = allLeavesDeltas[0]; 1218 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1219 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1220 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 1221 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1222 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1223 } 1224 1225 /** 1226 * Added abstract method 1227 */ 1228 @Test test49()1229 public void test49() { 1230 deployBundles("test49"); //$NON-NLS-1$ 1231 IApiBaseline before = getBeforeState(); 1232 IApiBaseline after = getAfterState(); 1233 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1234 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1235 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1236 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1237 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1238 assertNotNull("No delta", delta); //$NON-NLS-1$ 1239 IDelta[] allLeavesDeltas = collectLeaves(delta); 1240 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1241 IDelta child = allLeavesDeltas[0]; 1242 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1243 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1244 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1245 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1246 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1247 } 1248 1249 /** 1250 * Changes in a non-visible type should not report delta when only API is 1251 * requested 1252 */ 1253 @Test test50()1254 public void test50() { 1255 deployBundles("test50"); //$NON-NLS-1$ 1256 IApiBaseline before = getBeforeState(); 1257 IApiBaseline after = getAfterState(); 1258 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1259 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1260 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1261 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1262 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1263 assertNotNull("No delta", delta); //$NON-NLS-1$ 1264 assertTrue("No NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1265 } 1266 1267 /** 1268 * Changes in a visible type should report delta when only API is requested 1269 */ 1270 @Test test51()1271 public void test51() { 1272 deployBundles("test51"); //$NON-NLS-1$ 1273 IApiBaseline before = getBeforeState(); 1274 IApiBaseline after = getAfterState(); 1275 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1276 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1277 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1278 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1279 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1280 assertNotNull("No delta", delta); //$NON-NLS-1$ 1281 IDelta[] allLeavesDeltas = collectLeaves(delta); 1282 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1283 IDelta child = allLeavesDeltas[0]; 1284 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1285 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 1286 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1287 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1288 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1289 } 1290 1291 /** 1292 * Changes in a visible type should report delta when only API is requested 1293 * with extend restriction 1294 */ 1295 @Test test52()1296 public void test52() { 1297 deployBundles("test52"); //$NON-NLS-1$ 1298 IApiBaseline before = getBeforeState(); 1299 IApiBaseline after = getAfterState(); 1300 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1301 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1302 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1303 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1304 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1305 assertNotNull("No delta", delta); //$NON-NLS-1$ 1306 IDelta[] allLeavesDeltas = collectLeaves(delta); 1307 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1308 IDelta child = allLeavesDeltas[0]; 1309 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1310 assertTrue("No extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 1311 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1312 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1313 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1314 } 1315 1316 /** 1317 * Changes in a visible type should report delta when only API is requested 1318 */ 1319 @Test test53()1320 public void test53() { 1321 deployBundles("test53"); //$NON-NLS-1$ 1322 IApiBaseline before = getBeforeState(); 1323 IApiBaseline after = getAfterState(); 1324 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1325 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1326 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1327 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1328 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1329 assertNotNull("No delta", delta); //$NON-NLS-1$ 1330 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1331 IDelta[] allLeavesDeltas = collectLeaves(delta); 1332 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1333 IDelta child = allLeavesDeltas[0]; 1334 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1335 assertFalse("Extend restrictions", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 1336 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1337 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1338 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1339 } 1340 1341 /** 1342 * Add static to a private method 1343 */ 1344 @Test test54()1345 public void test54() { 1346 deployBundles("test54"); //$NON-NLS-1$ 1347 IApiBaseline before = getBeforeState(); 1348 IApiBaseline after = getAfterState(); 1349 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1350 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1351 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1352 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1353 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1354 assertNotNull("No delta", delta); //$NON-NLS-1$ 1355 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1356 IDelta[] allLeavesDeltas = collectLeaves(delta); 1357 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1358 IDelta child = allLeavesDeltas[0]; 1359 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1360 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1361 assertEquals("Wrong flag", IDelta.NON_STATIC_TO_STATIC, child.getFlags()); //$NON-NLS-1$ 1362 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1363 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1364 } 1365 1366 /** 1367 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=226128 1368 */ 1369 @Test test55()1370 public void test55() { 1371 deployBundles("test55"); //$NON-NLS-1$ 1372 IApiBaseline before = getBeforeState(); 1373 IApiBaseline after = getAfterState(); 1374 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1375 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1376 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1377 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1378 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1379 assertNotNull("No delta", delta); //$NON-NLS-1$ 1380 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1381 IDelta[] allLeavesDeltas = collectLeaves(delta); 1382 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1383 IDelta child = allLeavesDeltas[0]; 1384 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1385 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 1386 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1387 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1388 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1389 } 1390 1391 /** 1392 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=226128 1393 */ 1394 @Test test56()1395 public void test56() { 1396 deployBundles("test56"); //$NON-NLS-1$ 1397 IApiBaseline before = getBeforeState(); 1398 IApiBaseline after = getAfterState(); 1399 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1400 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1401 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1402 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1403 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1404 assertNotNull("No delta", delta); //$NON-NLS-1$ 1405 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1406 IDelta[] allLeavesDeltas = collectLeaves(delta); 1407 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1408 IDelta child = allLeavesDeltas[0]; 1409 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1410 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1411 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1412 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1413 assertTrue("Not private", Flags.isPrivate(child.getNewModifiers())); //$NON-NLS-1$ 1414 } 1415 1416 /** 1417 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228209 1418 */ 1419 @Test test57()1420 public void test57() { 1421 deployBundles("test57"); //$NON-NLS-1$ 1422 IApiBaseline before = getBeforeState(); 1423 IApiBaseline after = getAfterState(); 1424 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1425 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1426 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1427 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1428 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1429 assertNotNull("No delta", delta); //$NON-NLS-1$ 1430 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1431 IDelta[] allLeavesDeltas = collectLeaves(delta); 1432 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1433 IDelta child = allLeavesDeltas[0]; 1434 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1435 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 1436 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1437 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1438 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1439 } 1440 1441 /** 1442 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228209 1443 */ 1444 @Test test58()1445 public void test58() { 1446 deployBundles("test58"); //$NON-NLS-1$ 1447 IApiBaseline before = getBeforeState(); 1448 IApiBaseline after = getAfterState(); 1449 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1450 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1451 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1452 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1453 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1454 assertNotNull("No delta", delta); //$NON-NLS-1$ 1455 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1456 IDelta[] allLeavesDeltas = collectLeaves(delta); 1457 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1458 IDelta child = allLeavesDeltas[0]; 1459 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1460 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 1461 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1462 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1463 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1464 } 1465 1466 /** 1467 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228075 1468 */ 1469 @Test test59()1470 public void test59() { 1471 deployBundles("test59"); //$NON-NLS-1$ 1472 IApiBaseline before = getBeforeState(); 1473 IApiBaseline after = getAfterState(); 1474 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1475 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1476 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1477 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1478 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1479 assertNotNull("No delta", delta); //$NON-NLS-1$ 1480 IDelta[] allLeavesDeltas = collectLeaves(delta); 1481 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1482 IDelta child = allLeavesDeltas[0]; 1483 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1484 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 1485 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1486 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1487 } 1488 1489 /** 1490 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228075 1491 */ 1492 @Test test60()1493 public void test60() { 1494 deployBundles("test60"); //$NON-NLS-1$ 1495 IApiBaseline before = getBeforeState(); 1496 IApiBaseline after = getAfterState(); 1497 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1498 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1499 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1500 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1501 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1502 assertNotNull("No delta", delta); //$NON-NLS-1$ 1503 IDelta[] allLeavesDeltas = collectLeaves(delta); 1504 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1505 IDelta child = allLeavesDeltas[0]; 1506 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1507 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 1508 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1509 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1510 } 1511 1512 /** 1513 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228209 1514 */ 1515 @Test test61()1516 public void test61() { 1517 deployBundles("test61"); //$NON-NLS-1$ 1518 IApiBaseline before = getBeforeState(); 1519 IApiBaseline after = getAfterState(); 1520 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1521 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1522 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1523 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1524 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1525 assertNotNull("No delta", delta); //$NON-NLS-1$ 1526 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1527 IDelta[] allLeavesDeltas = collectLeaves(delta); 1528 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1529 IDelta child = allLeavesDeltas[0]; 1530 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1531 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 1532 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1533 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1534 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1535 } 1536 1537 /** 1538 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228209 1539 */ 1540 @Test test62()1541 public void test62() { 1542 deployBundles("test62"); //$NON-NLS-1$ 1543 IApiBaseline before = getBeforeState(); 1544 IApiBaseline after = getAfterState(); 1545 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1546 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1547 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1548 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1549 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1550 assertNotNull("No delta", delta); //$NON-NLS-1$ 1551 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1552 IDelta[] allLeavesDeltas = collectLeaves(delta); 1553 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1554 IDelta child = allLeavesDeltas[0]; 1555 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1556 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 1557 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1558 assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1559 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1560 } 1561 1562 /** 1563 * Remove @noreference on an existing method 1564 */ 1565 @Test test63()1566 public void test63() { 1567 deployBundles("test63"); //$NON-NLS-1$ 1568 IApiBaseline before = getBeforeState(); 1569 IApiBaseline after = getAfterState(); 1570 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1571 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1572 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1573 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1574 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1575 assertNotNull("No delta", delta); //$NON-NLS-1$ 1576 IDelta[] allLeavesDeltas = collectLeaves(delta); 1577 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1578 IDelta child = allLeavesDeltas[0]; 1579 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1580 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1581 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1582 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1583 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1584 } 1585 1586 /** 1587 * Add @noreference on an existing method 1588 */ 1589 @Test test64()1590 public void test64() { 1591 deployBundles("test64"); //$NON-NLS-1$ 1592 IApiBaseline before = getBeforeState(); 1593 IApiBaseline after = getAfterState(); 1594 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1595 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1596 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1597 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1598 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1599 assertNotNull("No delta", delta); //$NON-NLS-1$ 1600 IDelta[] allLeavesDeltas = collectLeaves(delta); 1601 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1602 IDelta child = allLeavesDeltas[0]; 1603 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1604 assertEquals("Wrong flag", IDelta.API_METHOD, child.getFlags()); //$NON-NLS-1$ 1605 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1606 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1607 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1608 } 1609 1610 /** 1611 * Add @noreference on an new method 1612 */ 1613 @Test test65()1614 public void test65() { 1615 deployBundles("test65"); //$NON-NLS-1$ 1616 IApiBaseline before = getBeforeState(); 1617 IApiBaseline after = getAfterState(); 1618 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1619 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1620 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1621 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1622 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1623 assertNotNull("No delta", delta); //$NON-NLS-1$ 1624 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1625 } 1626 1627 /** 1628 * Add @noreference on an new method 1629 */ 1630 @Test test66()1631 public void test66() { 1632 deployBundles("test66"); //$NON-NLS-1$ 1633 IApiBaseline before = getBeforeState(); 1634 IApiBaseline after = getAfterState(); 1635 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1636 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1637 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1638 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1639 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1640 assertNotNull("No delta", delta); //$NON-NLS-1$ 1641 IDelta[] allLeavesDeltas = collectLeaves(delta); 1642 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1643 IDelta child = allLeavesDeltas[0]; 1644 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1645 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 1646 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1647 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1648 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1649 } 1650 1651 /** 1652 * Remove @noreference on an existing constructor 1653 */ 1654 @Test test67()1655 public void test67() { 1656 deployBundles("test67"); //$NON-NLS-1$ 1657 IApiBaseline before = getBeforeState(); 1658 IApiBaseline after = getAfterState(); 1659 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1660 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1661 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1662 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1663 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1664 assertNotNull("No delta", delta); //$NON-NLS-1$ 1665 IDelta[] allLeavesDeltas = collectLeaves(delta); 1666 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1667 IDelta child = allLeavesDeltas[0]; 1668 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1669 assertEquals("Wrong flag", IDelta.CONSTRUCTOR, child.getFlags()); //$NON-NLS-1$ 1670 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1671 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1672 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1673 } 1674 1675 /** 1676 * Add @noreference on an existing constructor 1677 */ 1678 @Test test68()1679 public void test68() { 1680 deployBundles("test68"); //$NON-NLS-1$ 1681 IApiBaseline before = getBeforeState(); 1682 IApiBaseline after = getAfterState(); 1683 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1684 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1685 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1686 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1687 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1688 assertNotNull("No delta", delta); //$NON-NLS-1$ 1689 IDelta[] allLeavesDeltas = collectLeaves(delta); 1690 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1691 IDelta child = allLeavesDeltas[0]; 1692 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1693 assertEquals("Wrong flag", IDelta.API_CONSTRUCTOR, child.getFlags()); //$NON-NLS-1$ 1694 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1695 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1696 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1697 } 1698 1699 /** 1700 * Add @noreference on an new constructor 1701 */ 1702 @Test test69()1703 public void test69() { 1704 deployBundles("test69"); //$NON-NLS-1$ 1705 IApiBaseline before = getBeforeState(); 1706 IApiBaseline after = getAfterState(); 1707 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1708 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1709 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1710 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1711 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1712 assertNotNull("No delta", delta); //$NON-NLS-1$ 1713 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1714 } 1715 1716 /** 1717 * Add @noreference on an new constructor 1718 */ 1719 @Test test70()1720 public void test70() { 1721 deployBundles("test70"); //$NON-NLS-1$ 1722 IApiBaseline before = getBeforeState(); 1723 IApiBaseline after = getAfterState(); 1724 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1725 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1726 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1727 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1728 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1729 assertNotNull("No delta", delta); //$NON-NLS-1$ 1730 IDelta[] allLeavesDeltas = collectLeaves(delta); 1731 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1732 IDelta child = allLeavesDeltas[0]; 1733 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1734 assertEquals("Wrong flag", IDelta.CONSTRUCTOR, child.getFlags()); //$NON-NLS-1$ 1735 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1736 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1737 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1738 } 1739 1740 /** 1741 * Remove @noreference on an existing annotation method 1742 */ 1743 @Test test71()1744 public void test71() { 1745 deployBundles("test71"); //$NON-NLS-1$ 1746 IApiBaseline before = getBeforeState(); 1747 IApiBaseline after = getAfterState(); 1748 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1749 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1750 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1751 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1752 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1753 assertNotNull("No delta", delta); //$NON-NLS-1$ 1754 IDelta[] allLeavesDeltas = collectLeaves(delta); 1755 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1756 IDelta child = allLeavesDeltas[0]; 1757 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1758 assertEquals("Wrong flag", IDelta.METHOD_WITH_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1759 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1760 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1761 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1762 } 1763 1764 /** 1765 * Add @noreference on an existing annotation method 1766 */ 1767 @Test test72()1768 public void test72() { 1769 deployBundles("test72"); //$NON-NLS-1$ 1770 IApiBaseline before = getBeforeState(); 1771 IApiBaseline after = getAfterState(); 1772 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1773 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1774 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1775 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1776 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1777 assertNotNull("No delta", delta); //$NON-NLS-1$ 1778 IDelta[] allLeavesDeltas = collectLeaves(delta); 1779 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1780 IDelta child = allLeavesDeltas[0]; 1781 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1782 assertEquals("Wrong flag", IDelta.API_METHOD_WITH_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1783 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1784 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1785 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1786 } 1787 1788 /** 1789 * Add @noreference on an new annotation method 1790 */ 1791 @Test test73()1792 public void test73() { 1793 deployBundles("test73"); //$NON-NLS-1$ 1794 IApiBaseline before = getBeforeState(); 1795 IApiBaseline after = getAfterState(); 1796 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1797 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1798 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1799 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1800 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1801 assertNotNull("No delta", delta); //$NON-NLS-1$ 1802 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1803 } 1804 1805 /** 1806 * Add @noreference on an new annotation method 1807 */ 1808 @Test test74()1809 public void test74() { 1810 deployBundles("test74"); //$NON-NLS-1$ 1811 IApiBaseline before = getBeforeState(); 1812 IApiBaseline after = getAfterState(); 1813 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1814 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1815 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1816 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1817 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1818 assertNotNull("No delta", delta); //$NON-NLS-1$ 1819 IDelta[] allLeavesDeltas = collectLeaves(delta); 1820 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1821 IDelta child = allLeavesDeltas[0]; 1822 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1823 assertEquals("Wrong flag", IDelta.METHOD_WITH_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1824 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1825 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1826 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1827 } 1828 1829 /** 1830 * Remove @noreference on an existing annotation method 1831 */ 1832 @Test test75()1833 public void test75() { 1834 deployBundles("test75"); //$NON-NLS-1$ 1835 IApiBaseline before = getBeforeState(); 1836 IApiBaseline after = getAfterState(); 1837 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1838 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1839 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1840 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1841 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1842 assertNotNull("No delta", delta); //$NON-NLS-1$ 1843 IDelta[] allLeavesDeltas = collectLeaves(delta); 1844 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1845 IDelta child = allLeavesDeltas[0]; 1846 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1847 assertEquals("Wrong flag", IDelta.METHOD_WITHOUT_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1848 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1849 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1850 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1851 } 1852 1853 /** 1854 * Add @noreference on an existing annotation method 1855 */ 1856 @Test test76()1857 public void test76() { 1858 deployBundles("test76"); //$NON-NLS-1$ 1859 IApiBaseline before = getBeforeState(); 1860 IApiBaseline after = getAfterState(); 1861 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1862 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1863 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1864 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1865 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1866 assertNotNull("No delta", delta); //$NON-NLS-1$ 1867 IDelta[] allLeavesDeltas = collectLeaves(delta); 1868 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1869 IDelta child = allLeavesDeltas[0]; 1870 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1871 assertEquals("Wrong flag", IDelta.API_METHOD_WITHOUT_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1872 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1873 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1874 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1875 } 1876 1877 /** 1878 * Add @noreference on an new annotation method 1879 */ 1880 @Test test77()1881 public void test77() { 1882 deployBundles("test77"); //$NON-NLS-1$ 1883 IApiBaseline before = getBeforeState(); 1884 IApiBaseline after = getAfterState(); 1885 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1886 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1887 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1888 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1889 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1890 assertNotNull("No delta", delta); //$NON-NLS-1$ 1891 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1892 } 1893 1894 /** 1895 * Add @noreference on an new annotation method 1896 */ 1897 @Test test78()1898 public void test78() { 1899 deployBundles("test78"); //$NON-NLS-1$ 1900 IApiBaseline before = getBeforeState(); 1901 IApiBaseline after = getAfterState(); 1902 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1903 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1904 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1905 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1906 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1907 assertNotNull("No delta", delta); //$NON-NLS-1$ 1908 IDelta[] allLeavesDeltas = collectLeaves(delta); 1909 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1910 IDelta child = allLeavesDeltas[0]; 1911 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1912 assertEquals("Wrong flag", IDelta.METHOD_WITHOUT_DEFAULT_VALUE, child.getFlags()); //$NON-NLS-1$ 1913 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1914 assertEquals("Wrong element type", IDelta.ANNOTATION_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1915 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1916 } 1917 1918 /** 1919 * 229688 1920 */ 1921 @Test test79()1922 public void test79() { 1923 deployBundles("test79"); //$NON-NLS-1$ 1924 IApiBaseline before = getBeforeState(); 1925 IApiBaseline after = getAfterState(); 1926 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1927 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1928 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1929 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1930 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1931 assertNotNull("No delta", delta); //$NON-NLS-1$ 1932 IDelta[] allLeavesDeltas = collectLeaves(delta); 1933 assertEquals("Wrong size", 3, allLeavesDeltas.length); //$NON-NLS-1$ 1934 IDelta child = allLeavesDeltas[1]; 1935 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1936 assertEquals("Wrong flag", IDelta.SUPERCLASS, child.getFlags()); //$NON-NLS-1$ 1937 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1938 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1939 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1940 child = allLeavesDeltas[2]; 1941 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 1942 assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$ 1943 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 1944 assertEquals("Wrong element type", IDelta.API_COMPONENT_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1945 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1946 child = allLeavesDeltas[0]; 1947 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 1948 assertEquals("Wrong flag", IDelta.METHOD_MOVED_DOWN, child.getFlags()); //$NON-NLS-1$ 1949 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1950 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1951 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1952 } 1953 1954 /** 1955 * 244673 1956 */ 1957 @Test test80()1958 public void test80() { 1959 deployBundles("test80"); //$NON-NLS-1$ 1960 IApiBaseline before = getBeforeState(); 1961 IApiBaseline after = getAfterState(); 1962 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1963 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1964 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1965 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1966 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 1967 assertNotNull("No delta", delta); //$NON-NLS-1$ 1968 assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 1969 } 1970 1971 /** 1972 * 244673 1973 */ 1974 @Test test81()1975 public void test81() { 1976 deployBundles("test81"); //$NON-NLS-1$ 1977 IApiBaseline before = getBeforeState(); 1978 IApiBaseline after = getAfterState(); 1979 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 1980 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 1981 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 1982 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 1983 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 1984 assertNotNull("No delta", delta); //$NON-NLS-1$ 1985 IDelta[] allLeavesDeltas = collectLeaves(delta); 1986 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 1987 IDelta child = allLeavesDeltas[0]; 1988 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 1989 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 1990 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 1991 assertTrue("Not @noreferece restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 1992 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 1993 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 1994 } 1995 1996 /** 1997 * 244941 1998 */ 1999 @Test test82()2000 public void test82() { 2001 deployBundles("test82"); //$NON-NLS-1$ 2002 IApiBaseline before = getBeforeState(); 2003 IApiBaseline after = getAfterState(); 2004 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2005 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2006 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2007 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2008 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2009 assertNotNull("No delta", delta); //$NON-NLS-1$ 2010 IDelta[] allLeavesDeltas = collectLeaves(delta); 2011 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2012 IDelta child = allLeavesDeltas[0]; 2013 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2014 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2015 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2016 assertTrue("Not protected", Flags.isProtected(child.getNewModifiers())); //$NON-NLS-1$ 2017 assertTrue("Not @extend restriction", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2018 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2019 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2020 } 2021 2022 /** 2023 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244995 2024 */ 2025 @Test test83()2026 public void test83() { 2027 deployBundles("test83"); //$NON-NLS-1$ 2028 IApiBaseline before = getBeforeState(); 2029 IApiBaseline after = getAfterState(); 2030 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2031 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2032 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2033 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2034 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2035 assertNotNull("No delta", delta); //$NON-NLS-1$ 2036 IDelta[] allLeavesDeltas = collectLeaves(delta); 2037 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2038 IDelta child = allLeavesDeltas[0]; 2039 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2040 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2041 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2042 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2043 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2044 } 2045 2046 /** 2047 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244995 2048 */ 2049 @Test test84()2050 public void test84() { 2051 deployBundles("test84"); //$NON-NLS-1$ 2052 IApiBaseline before = getBeforeState(); 2053 IApiBaseline after = getAfterState(); 2054 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2055 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2056 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2057 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2058 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2059 assertNotNull("No delta", delta); //$NON-NLS-1$ 2060 IDelta[] allLeavesDeltas = collectLeaves(delta); 2061 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2062 IDelta child = allLeavesDeltas[0]; 2063 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2064 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2065 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2066 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2067 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2068 } 2069 2070 /** 2071 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2072 */ 2073 @Test test85()2074 public void test85() { 2075 deployBundles("test85"); //$NON-NLS-1$ 2076 IApiBaseline before = getBeforeState(); 2077 IApiBaseline after = getAfterState(); 2078 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2079 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2080 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2081 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2082 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2083 assertNotNull("No delta", delta); //$NON-NLS-1$ 2084 IDelta[] allLeavesDeltas = collectLeaves(delta); 2085 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2086 IDelta child = allLeavesDeltas[0]; 2087 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2088 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2089 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2090 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2091 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2092 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2093 } 2094 2095 /** 2096 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2097 */ 2098 @Test test86()2099 public void test86() { 2100 deployBundles("test86"); //$NON-NLS-1$ 2101 IApiBaseline before = getBeforeState(); 2102 IApiBaseline after = getAfterState(); 2103 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2104 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2105 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2106 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2107 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2108 assertNotNull("No delta", delta); //$NON-NLS-1$ 2109 IDelta[] allLeavesDeltas = collectLeaves(delta); 2110 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2111 IDelta child = allLeavesDeltas[0]; 2112 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2113 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2114 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2115 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2116 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2117 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2118 } 2119 2120 /** 2121 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2122 */ 2123 @Test test87()2124 public void test87() { 2125 deployBundles("test87"); //$NON-NLS-1$ 2126 IApiBaseline before = getBeforeState(); 2127 IApiBaseline after = getAfterState(); 2128 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2129 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2130 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2131 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2132 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2133 assertNotNull("No delta", delta); //$NON-NLS-1$ 2134 IDelta[] allLeavesDeltas = collectLeaves(delta); 2135 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2136 IDelta child = allLeavesDeltas[0]; 2137 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2138 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2139 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2140 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2141 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2142 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2143 } 2144 2145 /** 2146 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2147 */ 2148 @Test test88()2149 public void test88() { 2150 deployBundles("test88"); //$NON-NLS-1$ 2151 IApiBaseline before = getBeforeState(); 2152 IApiBaseline after = getAfterState(); 2153 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2154 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2155 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2156 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2157 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2158 assertNotNull("No delta", delta); //$NON-NLS-1$ 2159 IDelta[] allLeavesDeltas = collectLeaves(delta); 2160 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2161 IDelta child = allLeavesDeltas[0]; 2162 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2163 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2164 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2165 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2166 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2167 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2168 } 2169 2170 /** 2171 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2172 */ 2173 @Test test89()2174 public void test89() { 2175 deployBundles("test89"); //$NON-NLS-1$ 2176 IApiBaseline before = getBeforeState(); 2177 IApiBaseline after = getAfterState(); 2178 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2179 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2180 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2181 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2182 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2183 assertNotNull("No delta", delta); //$NON-NLS-1$ 2184 IDelta[] allLeavesDeltas = collectLeaves(delta); 2185 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2186 IDelta child = allLeavesDeltas[0]; 2187 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2188 assertEquals("Wrong flag", IDelta.NON_STATIC_TO_STATIC, child.getFlags()); //$NON-NLS-1$ 2189 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2190 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2191 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2192 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2193 } 2194 2195 /** 2196 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2197 */ 2198 @Test test90()2199 public void test90() { 2200 deployBundles("test90"); //$NON-NLS-1$ 2201 IApiBaseline before = getBeforeState(); 2202 IApiBaseline after = getAfterState(); 2203 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2204 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2205 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2206 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2207 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2208 assertNotNull("No delta", delta); //$NON-NLS-1$ 2209 IDelta[] allLeavesDeltas = collectLeaves(delta); 2210 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2211 IDelta child = allLeavesDeltas[0]; 2212 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2213 assertEquals("Wrong flag", IDelta.STATIC_TO_NON_STATIC, child.getFlags()); //$NON-NLS-1$ 2214 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2215 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2216 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2217 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2218 } 2219 2220 /** 2221 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2222 */ 2223 @Test test91()2224 public void test91() { 2225 deployBundles("test91"); //$NON-NLS-1$ 2226 IApiBaseline before = getBeforeState(); 2227 IApiBaseline after = getAfterState(); 2228 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2229 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2230 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2231 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2232 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2233 assertNotNull("No delta", delta); //$NON-NLS-1$ 2234 IDelta[] allLeavesDeltas = collectLeaves(delta); 2235 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2236 IDelta child = allLeavesDeltas[0]; 2237 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2238 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2239 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2240 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2241 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2242 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2243 } 2244 2245 /** 2246 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2247 */ 2248 @Test test92()2249 public void test92() { 2250 deployBundles("test92"); //$NON-NLS-1$ 2251 IApiBaseline before = getBeforeState(); 2252 IApiBaseline after = getAfterState(); 2253 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2254 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2255 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2256 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2257 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2258 assertNotNull("No delta", delta); //$NON-NLS-1$ 2259 IDelta[] allLeavesDeltas = collectLeaves(delta); 2260 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2261 IDelta child = allLeavesDeltas[0]; 2262 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2263 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2264 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2265 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2266 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2267 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2268 } 2269 2270 /** 2271 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=245166 2272 */ 2273 @Test test93()2274 public void test93() { 2275 deployBundles("test93"); //$NON-NLS-1$ 2276 IApiBaseline before = getBeforeState(); 2277 IApiBaseline after = getAfterState(); 2278 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2279 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2280 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2281 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2282 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2283 assertNotNull("No delta", delta); //$NON-NLS-1$ 2284 IDelta[] allLeavesDeltas = collectLeaves(delta); 2285 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2286 IDelta child = allLeavesDeltas[0]; 2287 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2288 assertEquals("Wrong flag", IDelta.DECREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2289 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2290 assertTrue("Not @reference restriction", RestrictionModifiers.isReferenceRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2291 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2292 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2293 } 2294 2295 /** 2296 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244620 2297 */ 2298 @Test test94()2299 public void test94() { 2300 deployBundles("test94"); //$NON-NLS-1$ 2301 IApiBaseline before = getBeforeState(); 2302 IApiBaseline after = getAfterState(); 2303 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2304 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2305 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2306 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2307 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2308 assertNotNull("No delta", delta); //$NON-NLS-1$ 2309 IDelta[] allLeavesDeltas = collectLeaves(delta); 2310 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2311 IDelta child = allLeavesDeltas[0]; 2312 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2313 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2314 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2315 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2316 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2317 } 2318 2319 /** 2320 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244620 2321 */ 2322 @Test test95()2323 public void test95() { 2324 deployBundles("test95"); //$NON-NLS-1$ 2325 IApiBaseline before = getBeforeState(); 2326 IApiBaseline after = getAfterState(); 2327 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2328 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2329 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2330 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2331 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2332 assertNotNull("No delta", delta); //$NON-NLS-1$ 2333 IDelta[] allLeavesDeltas = collectLeaves(delta); 2334 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2335 IDelta child = allLeavesDeltas[0]; 2336 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2337 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2338 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2339 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2340 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2341 } 2342 2343 /** 2344 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244620 2345 */ 2346 @Test test96()2347 public void test96() { 2348 deployBundles("test96"); //$NON-NLS-1$ 2349 IApiBaseline before = getBeforeState(); 2350 IApiBaseline after = getAfterState(); 2351 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2352 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2353 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2354 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2355 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2356 assertNotNull("No delta", delta); //$NON-NLS-1$ 2357 IDelta[] allLeavesDeltas = collectLeaves(delta); 2358 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2359 IDelta child = allLeavesDeltas[0]; 2360 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2361 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2362 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2363 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2364 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2365 } 2366 2367 /** 2368 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244620 2369 */ 2370 @Test test97()2371 public void test97() { 2372 deployBundles("test97"); //$NON-NLS-1$ 2373 IApiBaseline before = getBeforeState(); 2374 IApiBaseline after = getAfterState(); 2375 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2376 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2377 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2378 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2379 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2380 assertTrue("Not no delta", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2381 } 2382 2383 /** 2384 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=244620 2385 */ 2386 @Test test98()2387 public void test98() { 2388 deployBundles("test98"); //$NON-NLS-1$ 2389 IApiBaseline before = getBeforeState(); 2390 IApiBaseline after = getAfterState(); 2391 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2392 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2393 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2394 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2395 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2396 assertNotNull("No delta", delta); //$NON-NLS-1$ 2397 IDelta[] allLeavesDeltas = collectLeaves(delta); 2398 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2399 IDelta child = allLeavesDeltas[0]; 2400 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2401 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2402 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2403 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2404 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2405 } 2406 2407 /** 2408 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2409 */ 2410 @Test test99()2411 public void test99() { 2412 deployBundles("test99"); //$NON-NLS-1$ 2413 IApiBaseline before = getBeforeState(); 2414 IApiBaseline after = getAfterState(); 2415 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2416 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2417 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2418 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2419 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2420 assertNotNull("No delta", delta); //$NON-NLS-1$ 2421 IDelta[] allLeavesDeltas = collectLeaves(delta); 2422 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2423 IDelta child = allLeavesDeltas[0]; 2424 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2425 assertEquals("Wrong flag", IDelta.RESTRICTIONS, child.getFlags()); //$NON-NLS-1$ 2426 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2427 assertTrue("Not @override restriction", RestrictionModifiers.isOverrideRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2428 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2429 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2430 } 2431 2432 /** 2433 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2434 */ 2435 @Test test100()2436 public void test100() { 2437 deployBundles("test100"); //$NON-NLS-1$ 2438 IApiBaseline before = getBeforeState(); 2439 IApiBaseline after = getAfterState(); 2440 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2441 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2442 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2443 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2444 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2445 assertNotNull("No delta", delta); //$NON-NLS-1$ 2446 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2447 } 2448 2449 /** 2450 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2451 */ 2452 @Test test101()2453 public void test101() { 2454 deployBundles("test101"); //$NON-NLS-1$ 2455 IApiBaseline before = getBeforeState(); 2456 IApiBaseline after = getAfterState(); 2457 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2458 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2459 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2460 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2461 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2462 assertNotNull("No delta", delta); //$NON-NLS-1$ 2463 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2464 } 2465 2466 /** 2467 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2468 */ 2469 @Test test102()2470 public void test102() { 2471 deployBundles("test102"); //$NON-NLS-1$ 2472 IApiBaseline before = getBeforeState(); 2473 IApiBaseline after = getAfterState(); 2474 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2475 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2476 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2477 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2478 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2479 assertNotNull("No delta", delta); //$NON-NLS-1$ 2480 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2481 } 2482 2483 /** 2484 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2485 */ 2486 @Test test103()2487 public void test103() { 2488 deployBundles("test103"); //$NON-NLS-1$ 2489 IApiBaseline before = getBeforeState(); 2490 IApiBaseline after = getAfterState(); 2491 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2492 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2493 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2494 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2495 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2496 assertNotNull("No delta", delta); //$NON-NLS-1$ 2497 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2498 } 2499 2500 /** 2501 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=246767 2502 */ 2503 @Test test104()2504 public void test104() { 2505 deployBundles("test104"); //$NON-NLS-1$ 2506 IApiBaseline before = getBeforeState(); 2507 IApiBaseline after = getAfterState(); 2508 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2509 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2510 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2511 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2512 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2513 assertNotNull("No delta", delta); //$NON-NLS-1$ 2514 IDelta[] allLeavesDeltas = collectLeaves(delta); 2515 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2516 IDelta child = allLeavesDeltas[0]; 2517 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2518 assertEquals("Wrong flag", IDelta.RESTRICTIONS, child.getFlags()); //$NON-NLS-1$ 2519 assertFalse("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2520 assertTrue("Not @override restriction", RestrictionModifiers.isOverrideRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 2521 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2522 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2523 } 2524 2525 /** 2526 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=228209 2527 */ 2528 @Test test105()2529 public void test105() { 2530 deployBundles("test105"); //$NON-NLS-1$ 2531 IApiBaseline before = getBeforeState(); 2532 IApiBaseline after = getAfterState(); 2533 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2534 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2535 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2536 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2537 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2538 assertNotNull("No delta", delta); //$NON-NLS-1$ 2539 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2540 IDelta[] allLeavesDeltas = collectLeaves(delta); 2541 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2542 IDelta child = allLeavesDeltas[0]; 2543 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2544 assertEquals("Wrong flag", IDelta.OVERRIDEN_METHOD, child.getFlags()); //$NON-NLS-1$ 2545 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2546 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2547 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2548 } 2549 2550 /** 2551 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=242598 2552 */ 2553 @Test test106()2554 public void test106() { 2555 deployBundles("test106"); //$NON-NLS-1$ 2556 IApiBaseline before = getBeforeState(); 2557 IApiBaseline after = getAfterState(); 2558 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2559 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2560 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2561 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2562 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2563 assertNotNull("No delta", delta); //$NON-NLS-1$ 2564 assertFalse("Should not be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2565 IDelta[] allLeavesDeltas = collectLeaves(delta); 2566 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2567 IDelta child = allLeavesDeltas[0]; 2568 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2569 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 2570 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2571 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2572 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2573 } 2574 2575 /** 2576 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247632 2577 */ 2578 @Test test107()2579 public void test107() { 2580 deployBundles("test107"); //$NON-NLS-1$ 2581 IApiBaseline before = getBeforeState(); 2582 IApiBaseline after = getAfterState(); 2583 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2584 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2585 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2586 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2587 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2588 assertNotNull("No delta", delta); //$NON-NLS-1$ 2589 assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2590 } 2591 2592 /** 2593 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247952 2594 */ 2595 @Test test108()2596 public void test108() { 2597 deployBundles("test108"); //$NON-NLS-1$ 2598 IApiBaseline before = getBeforeState(); 2599 IApiBaseline after = getAfterState(); 2600 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2601 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2602 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2603 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2604 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2605 assertNotNull("No delta", delta); //$NON-NLS-1$ 2606 IDelta[] allLeavesDeltas = collectLeaves(delta); 2607 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2608 IDelta child = allLeavesDeltas[0]; 2609 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2610 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 2611 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2612 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2613 } 2614 2615 /** 2616 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=251513 2617 */ 2618 @Test test109()2619 public void test109() { 2620 deployBundles("test109"); //$NON-NLS-1$ 2621 IApiBaseline before = getBeforeState(); 2622 IApiBaseline after = getAfterState(); 2623 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2624 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2625 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2626 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2627 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2628 assertNotNull("No delta", delta); //$NON-NLS-1$ 2629 assertTrue("Different from NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 2630 } 2631 2632 /** 2633 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261176 2634 */ 2635 @Test test110()2636 public void test110() { 2637 deployBundles("test110"); //$NON-NLS-1$ 2638 IApiBaseline before = getBeforeState(); 2639 IApiBaseline after = getAfterState(); 2640 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2641 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2642 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2643 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2644 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 2645 assertNotNull("No delta", delta); //$NON-NLS-1$ 2646 IDelta[] allLeavesDeltas = collectLeaves(delta); 2647 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 2648 IDelta child = allLeavesDeltas[0]; 2649 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2650 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2651 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2652 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2653 child = allLeavesDeltas[1]; 2654 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 2655 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 2656 assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2657 assertFalse("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2658 } 2659 2660 /** 2661 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=267545 2662 */ 2663 @Test test111()2664 public void test111() { 2665 deployBundles("test111"); //$NON-NLS-1$ 2666 IApiBaseline before = getBeforeState(); 2667 IApiBaseline after = getAfterState(); 2668 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2669 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2670 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2671 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2672 IDelta delta = ApiComparator.compare(before, after, VisibilityModifiers.API, true, null); 2673 assertNotNull("No delta", delta); //$NON-NLS-1$ 2674 IDelta[] allLeavesDeltas = collectLeaves(delta); 2675 assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$ 2676 IDelta child = allLeavesDeltas[0]; 2677 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2678 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2679 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2680 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2681 child = allLeavesDeltas[1]; 2682 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2683 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 2684 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2685 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2686 } 2687 2688 /** 2689 * Changed Map to Map<String, String> 2690 */ 2691 @Test test112()2692 public void test112() { 2693 deployBundles("test112"); //$NON-NLS-1$ 2694 IApiBaseline before = getBeforeState(); 2695 IApiBaseline after = getAfterState(); 2696 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2697 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2698 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2699 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2700 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2701 assertNotNull("No delta", delta); //$NON-NLS-1$ 2702 IDelta[] allLeavesDeltas = collectLeaves(delta); 2703 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2704 IDelta child = allLeavesDeltas[0]; 2705 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2706 assertEquals("Wrong flag", IDelta.TYPE_ARGUMENTS, child.getFlags()); //$NON-NLS-1$ 2707 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2708 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2709 } 2710 2711 /** 2712 * Changed Map to Map<String, String> 2713 */ 2714 @Test test113()2715 public void test113() { 2716 deployBundles("test113"); //$NON-NLS-1$ 2717 IApiBaseline before = getBeforeState(); 2718 IApiBaseline after = getAfterState(); 2719 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2720 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2721 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2722 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2723 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2724 assertNotNull("No delta", delta); //$NON-NLS-1$ 2725 IDelta[] allLeavesDeltas = collectLeaves(delta); 2726 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2727 IDelta child = allLeavesDeltas[0]; 2728 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2729 assertEquals("Wrong flag", IDelta.TYPE_ARGUMENTS, child.getFlags()); //$NON-NLS-1$ 2730 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2731 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2732 } 2733 2734 /** 2735 * Add type parameters (constructor) 2736 */ 2737 @Test test114()2738 public void test114() { 2739 deployBundles("test114"); //$NON-NLS-1$ 2740 IApiBaseline before = getBeforeState(); 2741 IApiBaseline after = getAfterState(); 2742 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2743 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2744 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2745 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2746 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2747 assertNotNull("No delta", delta); //$NON-NLS-1$ 2748 IDelta[] allLeavesDeltas = collectLeaves(delta); 2749 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2750 IDelta child = allLeavesDeltas[0]; 2751 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2752 assertEquals("Wrong flag", IDelta.TYPE_PARAMETERS, child.getFlags()); //$NON-NLS-1$ 2753 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2754 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2755 } 2756 2757 /** 2758 * Add checked exception (constructor) 2759 */ 2760 @Test test115()2761 public void test115() { 2762 deployBundles("test115"); //$NON-NLS-1$ 2763 IApiBaseline before = getBeforeState(); 2764 IApiBaseline after = getAfterState(); 2765 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2766 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2767 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2768 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2769 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2770 assertNotNull("No delta", delta); //$NON-NLS-1$ 2771 IDelta[] allLeavesDeltas = collectLeaves(delta); 2772 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2773 IDelta child = allLeavesDeltas[0]; 2774 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2775 assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2776 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 2777 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2778 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2779 } 2780 2781 /** 2782 * Add unchecked exception (constructor) 2783 */ 2784 @Test test116()2785 public void test116() { 2786 deployBundles("test116"); //$NON-NLS-1$ 2787 IApiBaseline before = getBeforeState(); 2788 IApiBaseline after = getAfterState(); 2789 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2790 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2791 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2792 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2793 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2794 assertNotNull("No delta", delta); //$NON-NLS-1$ 2795 IDelta[] allLeavesDeltas = collectLeaves(delta); 2796 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2797 IDelta child = allLeavesDeltas[0]; 2798 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2799 assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2800 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 2801 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2802 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2803 } 2804 2805 /** 2806 * Change last parameter from array to varargs (constructor) 2807 */ 2808 @Test test117()2809 public void test117() { 2810 deployBundles("test117"); //$NON-NLS-1$ 2811 IApiBaseline before = getBeforeState(); 2812 IApiBaseline after = getAfterState(); 2813 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2814 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2815 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2816 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2817 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2818 assertNotNull("No delta", delta); //$NON-NLS-1$ 2819 IDelta[] allLeavesDeltas = collectLeaves(delta); 2820 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2821 IDelta child = allLeavesDeltas[0]; 2822 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2823 assertEquals("Wrong flag", IDelta.ARRAY_TO_VARARGS, child.getFlags()); //$NON-NLS-1$ 2824 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2825 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2826 } 2827 2828 /** 2829 * Removed unchecked exception (constructor) 2830 */ 2831 @Test test118()2832 public void test118() { 2833 deployBundles("test118"); //$NON-NLS-1$ 2834 IApiBaseline before = getBeforeState(); 2835 IApiBaseline after = getAfterState(); 2836 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2837 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2838 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2839 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2840 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2841 assertNotNull("No delta", delta); //$NON-NLS-1$ 2842 IDelta[] allLeavesDeltas = collectLeaves(delta); 2843 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2844 IDelta child = allLeavesDeltas[0]; 2845 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 2846 assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2847 assertEquals("Wrong flag", IDelta.UNCHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 2848 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2849 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2850 } 2851 2852 /** 2853 * Removed checked exception (constructor) 2854 */ 2855 @Test test119()2856 public void test119() { 2857 deployBundles("test119"); //$NON-NLS-1$ 2858 IApiBaseline before = getBeforeState(); 2859 IApiBaseline after = getAfterState(); 2860 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2861 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2862 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2863 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2864 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2865 assertNotNull("No delta", delta); //$NON-NLS-1$ 2866 IDelta[] allLeavesDeltas = collectLeaves(delta); 2867 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2868 IDelta child = allLeavesDeltas[0]; 2869 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 2870 assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2871 assertEquals("Wrong flag", IDelta.CHECKED_EXCEPTION, child.getFlags()); //$NON-NLS-1$ 2872 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2873 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2874 } 2875 2876 /** 2877 * Increased access (constructor) 2878 */ 2879 @Test test120()2880 public void test120() { 2881 deployBundles("test120"); //$NON-NLS-1$ 2882 IApiBaseline before = getBeforeState(); 2883 IApiBaseline after = getAfterState(); 2884 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2885 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2886 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2887 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2888 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2889 assertNotNull("No delta", delta); //$NON-NLS-1$ 2890 IDelta[] allLeavesDeltas = collectLeaves(delta); 2891 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2892 IDelta child = allLeavesDeltas[0]; 2893 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2894 assertTrue("Is visible", !Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2895 assertEquals("Wrong flag", IDelta.INCREASE_ACCESS, child.getFlags()); //$NON-NLS-1$ 2896 assertEquals("Wrong element type", IDelta.CONSTRUCTOR_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2897 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2898 } 2899 2900 /** 2901 * Non-final to final for @nooverride method 2902 */ 2903 @Test test121()2904 public void test121() { 2905 deployBundles("test121"); //$NON-NLS-1$ 2906 IApiBaseline before = getBeforeState(); 2907 IApiBaseline after = getAfterState(); 2908 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2909 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2910 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2911 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2912 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2913 assertNotNull("No delta", delta); //$NON-NLS-1$ 2914 IDelta[] allLeavesDeltas = collectLeaves(delta); 2915 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2916 IDelta child = allLeavesDeltas[0]; 2917 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2918 assertTrue("Is visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2919 assertEquals("Wrong flag", IDelta.NON_FINAL_TO_FINAL, child.getFlags()); //$NON-NLS-1$ 2920 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2921 assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2922 } 2923 2924 @Test test122()2925 public void test122() { 2926 deployBundles("test122"); //$NON-NLS-1$ 2927 IApiBaseline before = getBeforeState(); 2928 IApiBaseline after = getAfterState(); 2929 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2930 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2931 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2932 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2933 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2934 assertNotNull("No delta", delta); //$NON-NLS-1$ 2935 IDelta[] allLeavesDeltas = collectLeaves(delta); 2936 assertEquals("Wrong size", 3, allLeavesDeltas.length); //$NON-NLS-1$ 2937 IDelta child = allLeavesDeltas[0]; 2938 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2939 assertEquals("Wrong flag", IDelta.METHOD_MOVED_DOWN, child.getFlags()); //$NON-NLS-1$ 2940 assertTrue("Not visible", Util.isVisible(child.getNewModifiers())); //$NON-NLS-1$ 2941 assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2942 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2943 child = allLeavesDeltas[1]; 2944 assertEquals("Wrong kind", IDelta.CHANGED, child.getKind()); //$NON-NLS-1$ 2945 assertEquals("Wrong flag", IDelta.CONTRACTED_SUPERINTERFACES_SET, child.getFlags()); //$NON-NLS-1$ 2946 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 2947 assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2948 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2949 child = allLeavesDeltas[2]; 2950 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 2951 assertEquals("Wrong flag", IDelta.TYPE, child.getFlags()); //$NON-NLS-1$ 2952 assertTrue("Not visible", Util.isVisible(child.getOldModifiers())); //$NON-NLS-1$ 2953 assertEquals("Wrong element type", IDelta.API_COMPONENT_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2954 assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2955 } 2956 2957 /** 2958 * Added deprecation 2959 */ 2960 @Test test123()2961 public void test123() { 2962 deployBundles("test123"); //$NON-NLS-1$ 2963 IApiBaseline before = getBeforeState(); 2964 IApiBaseline after = getAfterState(); 2965 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2966 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2967 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2968 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2969 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2970 assertNotNull("No delta", delta); //$NON-NLS-1$ 2971 IDelta[] allLeavesDeltas = collectLeaves(delta); 2972 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2973 IDelta child = allLeavesDeltas[0]; 2974 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 2975 assertEquals("Wrong flag", IDelta.DEPRECATION, child.getFlags()); //$NON-NLS-1$ 2976 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 2977 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 2978 } 2979 2980 /** 2981 * Removed deprecation 2982 */ 2983 @Test test124()2984 public void test124() { 2985 deployBundles("test124"); //$NON-NLS-1$ 2986 IApiBaseline before = getBeforeState(); 2987 IApiBaseline after = getAfterState(); 2988 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 2989 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 2990 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 2991 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 2992 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 2993 assertNotNull("No delta", delta); //$NON-NLS-1$ 2994 IDelta[] allLeavesDeltas = collectLeaves(delta); 2995 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 2996 IDelta child = allLeavesDeltas[0]; 2997 assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$ 2998 assertEquals("Wrong flag", IDelta.DEPRECATION, child.getFlags()); //$NON-NLS-1$ 2999 assertEquals("Wrong element type", IDelta.METHOD_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 3000 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 3001 } 3002 3003 /** 3004 * Added public method into protected member interface inside a class tagged 3005 * as noextend 3006 */ 3007 @Test test125()3008 public void test125() { 3009 deployBundles("test125"); //$NON-NLS-1$ 3010 IApiBaseline before = getBeforeState(); 3011 IApiBaseline after = getAfterState(); 3012 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 3013 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 3014 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 3015 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 3016 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null); 3017 assertTrue("Not no delta", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$ 3018 } 3019 3020 /** 3021 * Added public method into protected member interface inside a class tagged 3022 * as noextend 3023 */ 3024 @Test test126()3025 public void test126() { 3026 deployBundles("test126"); //$NON-NLS-1$ 3027 IApiBaseline before = getBeforeState(); 3028 IApiBaseline after = getAfterState(); 3029 IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); 3030 assertNotNull("no api component", beforeApiComponent); //$NON-NLS-1$ 3031 IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); 3032 assertNotNull("no api component", afterApiComponent); //$NON-NLS-1$ 3033 IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null); 3034 assertNotNull("No delta", delta); //$NON-NLS-1$ 3035 IDelta[] allLeavesDeltas = collectLeaves(delta); 3036 assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$ 3037 IDelta child = allLeavesDeltas[0]; 3038 assertEquals("Wrong kind", IDelta.ADDED, child.getKind()); //$NON-NLS-1$ 3039 assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); //$NON-NLS-1$ 3040 assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$ 3041 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 3042 assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$ 3043 assertTrue("Not noextend", RestrictionModifiers.isExtendRestriction(child.getCurrentRestrictions())); //$NON-NLS-1$ 3044 } 3045 } 3046