Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 327452 | Differences between
and this patch

Collapse All | Expand All

(-)a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/InterfaceDeltaTests.java (-1 / +3 lines)
Lines 1104-1111 Link Here
1104
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null);
1104
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API, null);
1105
		assertNotNull("No delta", delta); //$NON-NLS-1$
1105
		assertNotNull("No delta", delta); //$NON-NLS-1$
1106
		IDelta[] allLeavesDeltas = collectLeaves(delta);
1106
		IDelta[] allLeavesDeltas = collectLeaves(delta);
1107
		assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
1107
		assertEquals("Wrong size", 2, allLeavesDeltas.length); //$NON-NLS-1$
1108
		IDelta child = allLeavesDeltas[0];
1108
		IDelta child = allLeavesDeltas[0];
1109
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
1109
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
1110
		child = allLeavesDeltas[1];
1111
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
1110
	}
1112
	}
1111
}
1113
}
(-)a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/RestrictionsDeltaTests.java (-5 / +17 lines)
Lines 266-272 Link Here
266
		assertTrue("Has no description", afterApiComponent.hasApiDescription()); //$NON-NLS-1$
266
		assertTrue("Has no description", afterApiComponent.hasApiDescription()); //$NON-NLS-1$
267
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null);
267
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null);
268
		assertNotNull("No delta", delta); //$NON-NLS-1$
268
		assertNotNull("No delta", delta); //$NON-NLS-1$
269
		assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
269
		IDelta[] allLeavesDeltas = collectLeaves(delta);
270
		assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
271
		IDelta child = allLeavesDeltas[0];
272
		assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
273
		assertEquals("Wrong flag", IDelta.RESTRICTIONS, child.getFlags()); //$NON-NLS-1$
274
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
275
		assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
270
	}
276
	}
271
277
272
	/**
278
	/**
Lines 285-293 Link Here
285
		assertTrue("Has no description", afterApiComponent.hasApiDescription()); //$NON-NLS-1$
291
		assertTrue("Has no description", afterApiComponent.hasApiDescription()); //$NON-NLS-1$
286
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null);
292
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.ALL_VISIBILITIES, null);
287
		assertNotNull("No delta", delta); //$NON-NLS-1$
293
		assertNotNull("No delta", delta); //$NON-NLS-1$
288
		assertTrue("Should be NO_DELTA", delta == ApiComparator.NO_DELTA); //$NON-NLS-1$
294
		IDelta[] allLeavesDeltas = collectLeaves(delta);
295
		assertEquals("Wrong size", 1, allLeavesDeltas.length); //$NON-NLS-1$
296
		IDelta child = allLeavesDeltas[0];
297
		assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); //$NON-NLS-1$
298
		assertEquals("Wrong flag", IDelta.RESTRICTIONS, child.getFlags()); //$NON-NLS-1$
299
		assertEquals("Wrong element type", IDelta.INTERFACE_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
300
		assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
289
	}
301
	}
290
	
302
291
	/**
303
	/**
292
	 * Add @noextend on a final class and remove final on the new version of the
304
	 * Add @noextend on a final class and remove final on the new version of the
293
	 * class 247654
305
	 * class 247654
Lines 313-319 Link Here
313
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
325
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
314
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
326
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
315
	}
327
	}
316
	
328
317
	/**
329
	/**
318
	 * Add @noinstantiate on an abstract class and remove abstract on the new
330
	 * Add @noinstantiate on an abstract class and remove abstract on the new
319
	 * version of the class 247654
331
	 * version of the class 247654
Lines 339-345 Link Here
339
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
351
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); //$NON-NLS-1$
340
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
352
		assertTrue("Not compatible", DeltaProcessor.isCompatible(child)); //$NON-NLS-1$
341
	}
353
	}
342
	
354
343
	/**
355
	/**
344
	 * Add extend restrictions
356
	 * Add extend restrictions
345
	 */
357
	 */
(-)a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java (+4 lines)
Lines 1964-1969 Link Here
1964
							}
1964
							}
1965
							break;
1965
							break;
1966
						}
1966
						}
1967
						case IDelta.REMOVED:{
1968
							this.fBuildState.addCompatibleChange(delta);
1969
							break;
1970
						}
1967
						default:
1971
						default:
1968
							break;
1972
							break;
1969
					}
1973
					}
(-)a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java (+13 lines)
Lines 975-980 Link Here
975
							if ((RestrictionModifiers.isImplementRestriction(restrictions2) && !RestrictionModifiers.isImplementRestriction(restrictions)) || (RestrictionModifiers.isExtendRestriction(restrictions2) && !RestrictionModifiers.isExtendRestriction(restrictions))) {
975
							if ((RestrictionModifiers.isImplementRestriction(restrictions2) && !RestrictionModifiers.isImplementRestriction(restrictions)) || (RestrictionModifiers.isExtendRestriction(restrictions2) && !RestrictionModifiers.isExtendRestriction(restrictions))) {
976
								this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
976
								this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
977
							}
977
							}
978
							if ((!RestrictionModifiers.isImplementRestriction(restrictions2) && RestrictionModifiers.isImplementRestriction(restrictions)) || (!RestrictionModifiers.isExtendRestriction(restrictions2) && RestrictionModifiers.isExtendRestriction(restrictions))) {
979
								this.addDelta(getElementType(this.type1), IDelta.REMOVED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
980
							}
978
						} else {
981
						} else {
979
							boolean reportChangedRestrictions = false;
982
							boolean reportChangedRestrictions = false;
980
							if (!Flags.isFinal(typeAccess2) && !Flags.isFinal(typeAccess)) {
983
							if (!Flags.isFinal(typeAccess2) && !Flags.isFinal(typeAccess)) {
Lines 982-993 Link Here
982
									reportChangedRestrictions = true;
985
									reportChangedRestrictions = true;
983
									this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
986
									this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
984
								}
987
								}
988
								if (!RestrictionModifiers.isExtendRestriction(restrictions2) && RestrictionModifiers.isExtendRestriction(restrictions)) {
989
									reportChangedRestrictions = true;
990
									this.addDelta(getElementType(this.type1), IDelta.REMOVED, IDelta.RESTRICTIONS,restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(),Util.getDescriptorName(type1));
991
								}
985
							}
992
							}
986
							if (!reportChangedRestrictions && !Flags.isAbstract(typeAccess2) && !Flags.isAbstract(typeAccess)) {
993
							if (!reportChangedRestrictions && !Flags.isAbstract(typeAccess2) && !Flags.isAbstract(typeAccess)) {
987
								if (RestrictionModifiers.isInstantiateRestriction(restrictions2) && !RestrictionModifiers.isInstantiateRestriction(restrictions)) {
994
								if (RestrictionModifiers.isInstantiateRestriction(restrictions2) && !RestrictionModifiers.isInstantiateRestriction(restrictions)) {
988
									this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
995
									this.addDelta(getElementType(this.type1), IDelta.ADDED, IDelta.RESTRICTIONS, restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(), Util.getDescriptorName(type1));
989
								}
996
								}
990
							}
997
							}
998
							if (!reportChangedRestrictions && !Flags.isAbstract(typeAccess2)
999
									&& !Flags.isAbstract(typeAccess)) {
1000
								if (!RestrictionModifiers.isInstantiateRestriction(restrictions2) && RestrictionModifiers.isInstantiateRestriction(restrictions)) {
1001
									this.addDelta(getElementType(this.type1), IDelta.REMOVED, IDelta.RESTRICTIONS,restrictions2, typeAccess, typeAccess2, this.type2, this.type2.getName(),Util.getDescriptorName(type1));
1002
								}
1003
							}
991
						}
1004
						}
992
					}
1005
					}
993
				}
1006
				}
(-)a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/Messages.java (+4 lines)
Lines 260-265 Link Here
260
									return 31;
260
									return 31;
261
								}
261
								}
262
								return 32;
262
								return 32;
263
							case IDelta.RESTRICTIONS:
264
								return 112;
263
							case IDelta.TYPE_MEMBER:
265
							case IDelta.TYPE_MEMBER:
264
								if (Flags.isProtected(delta.getOldModifiers())) {
266
								if (Flags.isProtected(delta.getOldModifiers())) {
265
									return 33;
267
									return 33;
Lines 432-437 Link Here
432
								return 61;
434
								return 61;
433
							case IDelta.DEPRECATION:
435
							case IDelta.DEPRECATION:
434
								return 111;
436
								return 111;
437
							case IDelta.RESTRICTIONS:
438
								return 112;
435
							default:
439
							default:
436
								break;
440
								break;
437
						}
441
						}
(-)a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/compatible_delta_messages.properties (-1 / +3 lines)
Lines 227-230 Link Here
227
# {0} given element
227
# {0} given element
228
110=The deprecation modifiers has been added to {0}
228
110=The deprecation modifiers has been added to {0}
229
# {0} given element
229
# {0} given element
230
111=The deprecation modifiers has been removed from {0}
230
111=The deprecation modifiers has been removed from {0}
231
# {0} type name
232
112 = Restrictions have been removed for type {0}

Return to bug 327452