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 247703 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityInternalTests.java (-8 / +5 lines)
Lines 30-37 Link Here
30
	 * Workspace relative path classes in bundle/project A
30
	 * Workspace relative path classes in bundle/project A
31
	 */
31
	 */
32
	protected static IPath WORKSPACE_CLASSES_PACKAGE_A = new Path("bundle.a/src/a/classes/internal");
32
	protected static IPath WORKSPACE_CLASSES_PACKAGE_A = new Path("bundle.a/src/a/classes/internal");
33
	
34
	protected static IPath WORKSPACE_CLASSES_PACKAGE_HIER = new Path("bundle.a/src/a/classes/hierarchy");
35
33
36
	/**
34
	/**
37
	 * Package prefix for test classes
35
	 * Package prefix for test classes
Lines 77-83 Link Here
77
	protected String getTestingProjectName() {
75
	protected String getTestingProjectName() {
78
		return "classcompat";
76
		return "classcompat";
79
	}
77
	}
80
	
78
81
	/**
79
	/**
82
	 * Tests the removal of a constructor from a non-API class.
80
	 * Tests the removal of a constructor from a non-API class.
83
	 */
81
	 */
Lines 86-100 Link Here
86
		// no problems expected
84
		// no problems expected
87
		performCompatibilityTest(filePath, incremental);
85
		performCompatibilityTest(filePath, incremental);
88
	}
86
	}
89
	
87
90
	public void testRemoveInternalConstructorI() throws Exception {
88
	public void testRemoveInternalConstructorI() throws Exception {
91
		xRemoveInternalConstructor(true);
89
		xRemoveInternalConstructor(true);
92
	}
90
	}
93
	
91
94
	public void testRemoveInternalConstructorF() throws Exception {
92
	public void testRemoveInternalConstructorF() throws Exception {
95
		xRemoveInternalConstructor(false);
93
		xRemoveInternalConstructor(false);
96
	}
94
	}
97
	
95
98
	/**
96
	/**
99
	 * Tests the removal of a method from a non-API class, subclassed by an API class.
97
	 * Tests the removal of a method from a non-API class, subclassed by an API class.
100
	 */
98
	 */
Lines 116-123 Link Here
116
	}
114
	}
117
	
115
	
118
	public void testRemoveInternalMethodI() throws Exception {
116
	public void testRemoveInternalMethodI() throws Exception {
119
		// TODO: should be problem on existing API class
117
		xRemoveInternalMethod(true);
120
		// xRemoveInternalMethod(true);
121
	}
118
	}
122
	
119
	
123
	public void testRemoveInternalMethodF() throws Exception {
120
	public void testRemoveInternalMethodF() throws Exception {
(-)src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityHierarchyTests.java (-9 / +16 lines)
Lines 110-116 Link Here
110
		setExpectedMessageArgs(args);
110
		setExpectedMessageArgs(args);
111
		performCompatibilityTest(filePath, incremental);
111
		performCompatibilityTest(filePath, incremental);
112
	}
112
	}
113
114
	public void testRemoveIntSuperClassWithMethodI() throws Exception {
115
		xRemoveIntSuperClassWithMethod(true);
116
	}
113
	
117
	
118
	public void testRemoveIntSuperClassWithMethodF() throws Exception {
119
		xRemoveIntSuperClassWithMethod(false);
120
	}
121
114
	public void testReduceHierarchyCtoAI() throws Exception {
122
	public void testReduceHierarchyCtoAI() throws Exception {
115
		xReduceHierarchyCtoA(true);
123
		xReduceHierarchyCtoA(true);
116
	}	
124
	}	
Lines 265-271 Link Here
265
		// no problems expected
273
		// no problems expected
266
		performCompatibilityTest(filePath, incremental);
274
		performCompatibilityTest(filePath, incremental);
267
	}
275
	}
268
	
276
269
	public void testAddInterfaceAI() throws Exception {
277
	public void testAddInterfaceAI() throws Exception {
270
		xAddInterfaceA(true);
278
		xAddInterfaceA(true);
271
	}	
279
	}	
Lines 318-334 Link Here
318
	 */
326
	 */
319
	private void xRemoveIntSuperClassWithMethod(boolean incremental) throws Exception {
327
	private void xRemoveIntSuperClassWithMethod(boolean incremental) throws Exception {
320
		IPath filePath = WORKSPACE_CLASSES_PACKAGE_A.append("RemoveIntSuperClassWithMethod.java");
328
		IPath filePath = WORKSPACE_CLASSES_PACKAGE_A.append("RemoveIntSuperClassWithMethod.java");
321
		// TODO: expect a removed method problem
329
		int[] ids = new int[] {
330
				getRemovedProblemId(IDelta.METHOD)
331
			};
332
			setExpectedProblemIds(ids);
333
			String[][] args = new String[1][];
334
			args[0] = new String[]{PACKAGE_PREFIX + "RemoveIntSuperClassWithMethod", "method()"};
335
			setExpectedMessageArgs(args);
322
		performCompatibilityTest(filePath, incremental);
336
		performCompatibilityTest(filePath, incremental);
323
	}
337
	}
324
	
338
	
325
	public void testRemoveIntSuperClassWithMethodI() throws Exception {
326
		xRemoveIntSuperClassWithMethod(true);
327
	}
328
	
329
	public void testRemoveIntSuperClassWithMethodF() throws Exception {
330
		xRemoveIntSuperClassWithMethod(false);
331
	}		
332
	
339
	
333
	/* (non-Javadoc)
340
	/* (non-Javadoc)
334
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getDefaultProblemId()
341
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getDefaultProblemId()
(-)test-builder/baseline/bundle.a/src/a/classes/internal/RemoveInternalConstructor.java (-1 / +1 lines)
Lines 15-20 Link Here
15
 */
15
 */
16
public class RemoveInternalConstructor {
16
public class RemoveInternalConstructor {
17
17
18
	public RemoveInternalConstructor() {}
18
	public RemoveInternalConstructor(int i) {}
19
19
20
}
20
}
(-)src/org/eclipse/pde/api/tools/comparator/tests/ClassDeltaTests.java (-2 / +47 lines)
Lines 36-42 Link Here
36
	public static Test suite() {
36
	public static Test suite() {
37
		if (true) return new TestSuite(ClassDeltaTests.class);
37
		if (true) return new TestSuite(ClassDeltaTests.class);
38
		TestSuite suite = new TestSuite(ClassDeltaTests.class.getName());
38
		TestSuite suite = new TestSuite(ClassDeltaTests.class.getName());
39
		suite.addTest(new ClassDeltaTests("test138"));
39
		suite.addTest(new ClassDeltaTests("test140"));
40
		return suite;
40
		return suite;
41
	}
41
	}
42
42
Lines 3229-3232 Link Here
3229
		assertEquals("Wrong flag", IDelta.METHOD, child.getFlags());
3229
		assertEquals("Wrong flag", IDelta.METHOD, child.getFlags());
3230
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType());
3230
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType());
3231
		assertFalse("Is compatible", DeltaProcessor.isCompatible(child));
3231
		assertFalse("Is compatible", DeltaProcessor.isCompatible(child));
3232
	}}
3232
	}
3233
	/**
3234
	 * Remove internal superclass that contains public method 
3235
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247703
3236
	 */
3237
	public void test139() {
3238
		deployBundles("test139");
3239
		IApiProfile before = getBeforeState();
3240
		IApiProfile after = getAfterState();
3241
		IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME);
3242
		assertNotNull("no api component", beforeApiComponent);
3243
		IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME);
3244
		assertNotNull("no api component", afterApiComponent);
3245
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API);
3246
		assertNotNull("No delta", delta);
3247
		IDelta[] allLeavesDeltas = collectLeaves(delta);
3248
		assertEquals("Wrong size", 1, allLeavesDeltas.length);
3249
		IDelta child = allLeavesDeltas[0];
3250
		assertEquals("Wrong kind", IDelta.REMOVED, child.getKind());
3251
		assertEquals("Wrong flag", IDelta.METHOD, child.getFlags());
3252
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType());
3253
		assertFalse("Is compatible", DeltaProcessor.isCompatible(child));
3254
	}
3255
	/**
3256
	 * Remove internal superclass that contains public method 
3257
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247703
3258
	 */
3259
	public void test140() {
3260
		deployBundles("test140");
3261
		IApiProfile before = getBeforeState();
3262
		IApiProfile after = getAfterState();
3263
		IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME);
3264
		assertNotNull("no api component", beforeApiComponent);
3265
		IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME);
3266
		assertNotNull("no api component", afterApiComponent);
3267
		IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API);
3268
		assertNotNull("No delta", delta);
3269
		IDelta[] allLeavesDeltas = collectLeaves(delta);
3270
		assertEquals("Wrong size", 1, allLeavesDeltas.length);
3271
		IDelta child = allLeavesDeltas[0];
3272
		assertEquals("Wrong kind", IDelta.REMOVED, child.getKind());
3273
		assertEquals("Wrong flag", IDelta.METHOD, child.getFlags());
3274
		assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType());
3275
		assertTrue("Is compatible", DeltaProcessor.isCompatible(child));
3276
	}
3277
}
(-)tests-deltas/class/test140/before/internal/p/Y.java (+5 lines)
Added Link Here
1
package internal.p;
2
3
public class Y {
4
	private void bar() {}
5
}
(-)tests-deltas/class/test139/after/p/X.java (+3 lines)
Added Link Here
1
package p;
2
3
public class X {}
(-)tests-deltas/class/test140/resources/before/MANIFEST.MF (+10 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Ant-Version: Apache Ant 1.7.0
3
Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
4
Bundle-ManifestVersion: 2
5
Bundle-Name: deltatest Plug-in
6
Bundle-SymbolicName: deltatest
7
Bundle-Version: 1.0.0
8
Bundle-RequiredExecutionEnvironment: J2SE-1.4
9
Export-Package: p,
10
 internal.p;x-internal:=true
(-)tests-deltas/class/test139/resources/after/META-INF/MANIFEST.MF (+10 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Ant-Version: Apache Ant 1.7.0
3
Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
4
Bundle-ManifestVersion: 2
5
Bundle-Name: deltatest Plug-in
6
Bundle-SymbolicName: deltatest
7
Bundle-Version: 2.0.0
8
Bundle-RequiredExecutionEnvironment: J2SE-1.4
9
Export-Package: p,
10
 internal.p;x-internal:=true
(-)tests-deltas/class/test139/resources/before/.api_description (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<component name="deltatest">
3
<plugin id="deltatest" />
4
</component>
(-)tests-deltas/class/test140/before/p/X.java (+3 lines)
Added Link Here
1
package p;
2
3
public class X extends internal.p.Y {}
(-)tests-deltas/class/test140/resources/after/.api_description (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<component name="deltatest">
3
<plugin id="deltatest" />
4
</component>
(-)tests-deltas/class/test139/before/p/X.java (+3 lines)
Added Link Here
1
package p;
2
3
public class X extends internal.p.Y {}
(-)tests-deltas/class/test140/after/p/X.java (+3 lines)
Added Link Here
1
package p;
2
3
public class X {}
(-)tests-deltas/class/test140/resources/after/META-INF/MANIFEST.MF (+10 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Ant-Version: Apache Ant 1.7.0
3
Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
4
Bundle-ManifestVersion: 2
5
Bundle-Name: deltatest Plug-in
6
Bundle-SymbolicName: deltatest
7
Bundle-Version: 2.0.0
8
Bundle-RequiredExecutionEnvironment: J2SE-1.4
9
Export-Package: p,
10
 internal.p;x-internal:=true
(-)tests-deltas/class/test139/after/internal/p/Y.java (+3 lines)
Added Link Here
1
package internal.p;
2
3
public class Y {}
(-)tests-deltas/class/test139/resources/before/MANIFEST.MF (+10 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Ant-Version: Apache Ant 1.7.0
3
Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.)
4
Bundle-ManifestVersion: 2
5
Bundle-Name: deltatest Plug-in
6
Bundle-SymbolicName: deltatest
7
Bundle-Version: 1.0.0
8
Bundle-RequiredExecutionEnvironment: J2SE-1.4
9
Export-Package: p,
10
 internal.p;x-internal:=true
(-)tests-deltas/class/test140/after/internal/p/Y.java (+3 lines)
Added Link Here
1
package internal.p;
2
3
public class Y {}
(-)tests-deltas/class/test140/resources/before/.api_description (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<component name="deltatest">
3
<plugin id="deltatest" />
4
</component>
(-)tests-deltas/class/test139/resources/after/.api_description (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<component name="deltatest">
3
<plugin id="deltatest" />
4
</component>
(-)tests-deltas/class/test139/before/internal/p/Y.java (+5 lines)
Added Link Here
1
package internal.p;
2
3
public class Y {
4
	public void bar() {}
5
}
(-)src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java (-2 / +2 lines)
Lines 658-670 Link Here
658
				continue;
658
				continue;
659
			}
659
			}
660
			updateMonitor(monitor, 0);
660
			updateMonitor(monitor, 0);
661
			if(changedtypes.contains(file)) {
661
//			if(changedtypes.contains(file)) {
662
				cleanupUnsupportedTagMarkers(file);
662
				cleanupUnsupportedTagMarkers(file);
663
				updateMonitor(monitor, 0);
663
				updateMonitor(monitor, 0);
664
				cleanupCompatibiltiyMarkers(file);
664
				cleanupCompatibiltiyMarkers(file);
665
				updateMonitor(monitor, 0);
665
				updateMonitor(monitor, 0);
666
				cnames.add(type.getFullyQualifiedName());
666
				cnames.add(type.getFullyQualifiedName());
667
			}
667
//			}
668
			try {
668
			try {
669
				cleanupUsageMarkers(file);
669
				cleanupUsageMarkers(file);
670
				updateMonitor(monitor, 0);
670
				updateMonitor(monitor, 0);
(-)src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java (-1 / +14 lines)
Lines 248-254 Link Here
248
			String superTypeName = this.type1.getSuperclassName();
248
			String superTypeName = this.type1.getSuperclassName();
249
			String superTypeName2 = this.type2.getSuperclassName();
249
			String superTypeName2 = this.type2.getSuperclassName();
250
			if (!superTypeName.equals(superTypeName2)) {
250
			if (!superTypeName.equals(superTypeName2)) {
251
				// we don't need to check the superclass if it has changed
251
				// if the superclass has changed we need to look at visible members have been removed or moved 
252
				// to a different location
253
				ClassFileResult pair = getType(superTypeName, this.component, this.apiProfile);
254
				if (pair == null) return;
255
				IClassFile superclassType1 = pair.getClassFile();
256
				IApiType typeStructure = TypeStructureCache.getTypeStructure(superclassType1, pair.getComponent());
257
				IApiMethod[] methods = typeStructure.getMethods();
258
				for (int i = 0, max = methods.length; i < max; i++) {
259
					getDeltaForMethod(methods[i]);
260
				}
261
				IApiField[] fields = typeStructure.getFields();
262
				for (int i = 0, max = fields.length; i < max; i++) {
263
					getDeltaForField(fields[i]);
264
				}
252
				return;
265
				return;
253
			}
266
			}
254
			ClassFileResult pair = getType(superTypeName, this.component, this.apiProfile);
267
			ClassFileResult pair = getType(superTypeName, this.component, this.apiProfile);

Return to bug 247703