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

Collapse All | Expand All

(-)test-builder/split/pre-split/a.b.c/src/a/b/c/ClassA.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.b.c;
12
13
/**
14
 *
15
 */
16
public class ClassA {
17
18
	public void methodOne(ClassA arg) {
19
		System.out.println(arg.getClass() + "methodOne()");
20
	}
21
}
(-)test-builder/split/post-split/a.b.c.core/src/d/e/f/ClassD.java (+22 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package d.e.f;
12
13
14
/**
15
 *
16
 */
17
public class ClassD {
18
19
	public void methodOne(ClassD arg) {
20
		System.out.println(arg.getClass() + "methodOne()");
21
	}
22
}
(-)src/org/eclipse/pde/api/tools/builder/tests/compatibility/BundleSplitTest.java (+476 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.api.tools.builder.tests.compatibility;
12
13
import java.io.File;
14
import java.io.FileInputStream;
15
import java.io.FileOutputStream;
16
import java.io.InputStream;
17
import java.util.HashSet;
18
import java.util.Set;
19
import java.util.jar.JarFile;
20
21
import junit.framework.Test;
22
23
import org.eclipse.core.resources.IFile;
24
import org.eclipse.core.resources.IFolder;
25
import org.eclipse.core.resources.IMarker;
26
import org.eclipse.core.resources.IProject;
27
import org.eclipse.core.resources.IResource;
28
import org.eclipse.core.resources.ResourcesPlugin;
29
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.Path;
31
import org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest;
32
import org.eclipse.pde.api.tools.builder.tests.ApiProblem;
33
import org.eclipse.pde.api.tools.builder.tests.ApiTestingEnvironment;
34
import org.eclipse.pde.api.tools.internal.ApiSettingsXmlVisitor;
35
import org.eclipse.pde.api.tools.internal.model.ApiModelFactory;
36
import org.eclipse.pde.api.tools.internal.problems.ApiProblemFactory;
37
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
38
import org.eclipse.pde.api.tools.internal.provisional.IApiBaselineManager;
39
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
40
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
41
import org.eclipse.pde.api.tools.internal.util.Util;
42
import org.eclipse.pde.api.tools.model.tests.TestSuiteHelper;
43
import org.eclipse.pde.api.tools.tests.ApiTestsPlugin;
44
45
/**
46
 * Tests for splitting plug-ins across releases
47
 * 
48
 * @since 1.0
49
 */
50
public class BundleSplitTest extends ApiBuilderTest {
51
52
	/**
53
	 * 
54
	 */
55
	public static final String WORKSPACE_PROFILE = "split/post-split";
56
	
57
	public static final String BASELINE = "split/pre-split";
58
59
	/**
60
	 * Constructor
61
	 * @param name
62
	 */
63
	public BundleSplitTest(String name) {
64
		super(name);
65
	}
66
	
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTests#setBuilderOptions()
69
	 */
70
	protected void setBuilderOptions() {
71
		enableUnsupportedTagOptions(false);
72
		enableBaselineOptions(true);
73
		enableCompatibilityOptions(true);
74
		enableLeakOptions(false);
75
		enableSinceTagOptions(false);
76
		enableUsageOptions(false);
77
		enableVersionNumberOptions(true);
78
	}
79
80
	/**
81
	 * @return the tests for this class
82
	 */
83
	public static Test suite() {
84
		return buildTestSuite(BundleSplitTest.class);
85
	}
86
	
87
	/* (non-Javadoc)
88
	 * 
89
	 * Ensure a baseline has been created to compare against.
90
	 * 
91
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#setUp()
92
	 */
93
	@Override
94
	protected void setUp() throws Exception {
95
		ApiTestingEnvironment env = getEnv();
96
		if (env != null) {
97
			env.setRevert(true);
98
		}
99
		super.setUp();		
100
		// build the baseline if not present
101
		IApiBaselineManager manager = ApiPlugin.getDefault().getApiBaselineManager();
102
		IApiBaseline baseline = manager.getDefaultApiBaseline();
103
		if (baseline == null) {
104
			// import baseline projects
105
			createExistingProjects(BASELINE, true);
106
			// create the API baseline
107
			IApiBaseline profile = manager.getWorkspaceBaseline();
108
			IProject[] projects = getEnv().getWorkspace().getRoot().getProjects();
109
			IPath baselineLocation = ApiTestsPlugin.getDefault().getStateLocation().append(BASELINE);
110
			for (int i = 0; i < projects.length; i++) {
111
				exportApiComponent(
112
						projects[i],
113
						profile.getApiComponent(projects[i].getName()), 
114
						baselineLocation);
115
			}
116
			baseline = ApiModelFactory.newApiBaseline("API-baseline");
117
			IApiComponent[] components = new IApiComponent[projects.length];
118
			for (int i = 0; i < projects.length; i++) {
119
				IProject project = projects[i];
120
				IPath location = baselineLocation.append(project.getName());
121
				components[i] = ApiModelFactory.newApiComponent(baseline, location.toOSString());
122
			}
123
			baseline.addApiComponents(components);
124
			manager.addApiBaseline(baseline);
125
			manager.setDefaultApiBaseline(baseline.getName());
126
			// delete the projects
127
			for (int i = 0; i < projects.length; i++) {
128
				getEnv().removeProject(projects[i].getFullPath());
129
			}
130
		}		
131
		// for the first test create workspace projects
132
		IProject[] projects = getEnv().getWorkspace().getRoot().getProjects();
133
		if (projects.length == 0) {
134
			// populate the workspace with initial plug-ins/projects
135
			createExistingProjects(WORKSPACE_PROFILE, true);
136
		} else {
137
			// build after revert
138
			incrementalBuild();
139
		}
140
141
	}
142
	
143
	@Override
144
	protected void tearDown() throws Exception {
145
		super.tearDown();
146
		getEnv().setRevert(false);
147
	}
148
	
149
	/**
150
	 * Exports the project as an API component to be used in an API baseline.
151
	 * 
152
	 * @param project project to export
153
	 * @param apiComponent associated API component from the workspace profile
154
	 * @param baselineLocation local file system directory to host exported component
155
	 */
156
	private void exportApiComponent(IProject project, IApiComponent apiComponent, IPath baselineLocation) throws Exception {
157
		File root = baselineLocation.toFile();
158
		File componentDir = new File(root, project.getName());
159
		componentDir.mkdirs();
160
		IResource[] members = project.members();
161
		// copy root files and manifest
162
		for (int i = 0; i < members.length; i++) {
163
			IResource res = members[i];
164
			if (res.getType() == IResource.FILE) {
165
				copyFile(componentDir, (IFile)res);
166
			} else if (res.getType() == IResource.FOLDER) {
167
				if (res.getName().equals("META-INF")) {
168
					File manDir = new File(componentDir, "META-INF");
169
					manDir.mkdirs();
170
					copyFile(manDir, ((IFolder)res).getFile("MANIFEST.MF"));
171
				}
172
			}
173
		}
174
		// copy over .class files
175
		IFolder output = project.getFolder("bin");
176
		copyFolder(output, componentDir);
177
		// API Description
178
		ApiSettingsXmlVisitor visitor = new ApiSettingsXmlVisitor(apiComponent);
179
		apiComponent.getApiDescription().accept(visitor);
180
		String xml = visitor.getXML();
181
		File desc = new File(componentDir, ".api_description");
182
		desc.createNewFile();
183
		FileOutputStream stream = new FileOutputStream(desc);
184
		stream.write(xml.getBytes("UTF-8"));
185
		stream.close();
186
	}
187
	
188
	/**
189
	 * Copy the folder contents to the local file system.
190
	 * 
191
	 * @param folder workspace folder
192
	 * @param dir local directory
193
	 */
194
	private void copyFolder(IFolder folder, File dir) throws Exception {
195
		IResource[] members = folder.members();
196
		for (int i = 0; i < members.length; i++) {
197
			IResource res = members[i];
198
			if (res.getType() == IResource.FILE) {
199
				IFile file = (IFile) res;
200
				copyFile(dir, file);
201
			} else {
202
				IFolder nested = (IFolder) res;
203
				File next = new File(dir, nested.getName());
204
				next.mkdirs();
205
				copyFolder(nested, next);
206
			}
207
		}
208
	}
209
	
210
	/**
211
	 * Copies the given file to the given directory.
212
	 * 
213
	 * @param dir
214
	 * @param file
215
	 */
216
	private void copyFile(File dir, IFile file) throws Exception {
217
		File local = new File(dir, file.getName());
218
		local.createNewFile();
219
		FileOutputStream stream = new FileOutputStream(local);
220
		InputStream contents = file.getContents();
221
		byte[] bytes = Util.getInputStreamAsByteArray(contents, -1);
222
		stream.write(bytes);
223
		contents.close();
224
		stream.close();
225
	}	
226
	
227
	/**
228
	 * Updates the contents of a workspace file at the specified location (full path),
229
	 * with the contents of a local file at the given replacement location (absolute path).
230
	 * 
231
	 * @param workspaceLocation
232
	 * @param replacementLocation
233
	 */
234
	protected void updateWorkspaceFile(IPath workspaceLocation, IPath replacementLocation) throws Exception {
235
		IFile file = getEnv().getWorkspace().getRoot().getFile(workspaceLocation);
236
		assertTrue("Workspace file does not exist: " + workspaceLocation.toString(), file.exists());
237
		File replacement = replacementLocation.toFile();
238
		assertTrue("Replacement file does not exist: " + replacementLocation.toOSString(), replacement.exists());
239
		FileInputStream stream = new FileInputStream(replacement);
240
		file.setContents(stream, false, true, null);
241
		stream.close();
242
		getEnv().changed(workspaceLocation);
243
	}
244
	
245
	/**
246
	 * Updates the contents of a workspace file at the specified location (full path),
247
	 * with the contents of a local file at the given replacement location (absolute path).
248
	 * 
249
	 * @param workspaceLocation
250
	 * @param replacementLocation
251
	 */
252
	protected void createWorkspaceFile(IPath workspaceLocation, IPath replacementLocation) throws Exception {
253
		IFile file = getEnv().getWorkspace().getRoot().getFile(workspaceLocation);
254
		assertFalse("Workspace file should not exist: " + workspaceLocation.toString(), file.exists());
255
		File replacement = replacementLocation.toFile();
256
		assertTrue("Replacement file does not exist: " + replacementLocation.toOSString(), replacement.exists());
257
		FileInputStream stream = new FileInputStream(replacement);
258
		file.create(stream, false, null);
259
		stream.close();
260
		getEnv().added(workspaceLocation);
261
	}
262
	
263
	/**
264
	 * Deletes the workspace file at the specified location (full path).
265
	 * 
266
	 * @param workspaceLocation
267
	 */
268
	protected void deleteWorkspaceFile(IPath workspaceLocation) throws Exception {
269
		IFile file = getEnv().getWorkspace().getRoot().getFile(workspaceLocation);
270
		assertTrue("Workspace file does not exist: " + workspaceLocation.toString(), file.exists());
271
		file.delete(false, null);
272
		getEnv().removed(workspaceLocation);
273
	}	
274
	
275
	/**
276
	 * Returns a path in the local file system to an updated file based on this tests source path
277
	 * and filename.
278
	 * 
279
	 * @param filename name of file to update
280
	 * @return path to the file in the local file system
281
	 */
282
	protected IPath getUpdateFilePath(String filename) {
283
		return TestSuiteHelper.getPluginDirectoryPath().append(TEST_SOURCE_ROOT).append(getTestSourcePath()).append(filename);
284
	}
285
	/**
286
	 * Performs a compatibility test. The workspace file at the specified (full workspace path)
287
	 * location is updated with a corresponding file from test data. A build is performed
288
	 * and problems are compared against the expected problems for the associated resource.
289
	 * 
290
	 * @param workspaceFile file to update
291
	 * @param incremental whether to perform an incremental (<code>true</code>) or
292
	 * 	full (<code>false</code>) build
293
	 * @throws Exception
294
	 */
295
	protected void performCompatibilityTest(IPath workspaceFile, boolean incremental) throws Exception {
296
			updateWorkspaceFile(
297
					workspaceFile,
298
					getUpdateFilePath(workspaceFile.lastSegment()));
299
			if (incremental) {
300
				incrementalBuild();
301
			} else {
302
				fullBuild();
303
			}
304
			IMarker[] jdtMarkers = getEnv().getAllJDTMarkers(workspaceFile);
305
			int length = jdtMarkers.length;
306
			if (length != 0) {
307
				for (int i = 0; i < length; i++) {
308
					boolean condition = jdtMarkers[i].getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING) == IMarker.SEVERITY_ERROR;
309
					if (condition) {
310
						System.err.println("workspace file : " + workspaceFile.toOSString());
311
						System.err.println(jdtMarkers[i].getAttribute(IMarker.MESSAGE));
312
					}
313
					assertFalse("Should not be a JDT error", condition);
314
				}
315
			}
316
			ApiProblem[] problems = getEnv().getProblemsFor(workspaceFile, null);
317
			assertProblems(problems);
318
	}
319
	
320
	/**
321
	 * Performs a compatibility test. The workspace file at the specified (full workspace path)
322
	 * location is updated with a corresponding file from test data. A build is performed
323
	 * and problems are compared against the expected problems for the associated resource.
324
	 * 
325
	 * @param workspaceFile file to update
326
	 * @param incremental whether to perform an incremental (<code>true</code>) or
327
	 * 	full (<code>false</code>) build
328
	 * @throws Exception
329
	 */
330
	protected void performVersionTest(IPath workspaceFile, boolean incremental) throws Exception {
331
			updateWorkspaceFile(
332
					workspaceFile,
333
					getUpdateFilePath(workspaceFile.lastSegment()));
334
			if (incremental) {
335
				incrementalBuild();
336
			} else {
337
				fullBuild();
338
			}
339
			ApiProblem[] problems = getEnv().getProblemsFor(new Path(workspaceFile.segment(0)).append(JarFile.MANIFEST_NAME), null);
340
			assertProblems(problems);
341
	}	
342
	
343
	/**
344
	 * Performs a compatibility test. The workspace file at the specified (full workspace path)
345
	 * location is deleted. A build is performed and problems are compared against the expected
346
	 * problems for the associated resource.
347
	 * 
348
	 * @param workspaceFile file to update
349
	 * @param incremental whether to perform an incremental (<code>true</code>) or
350
	 * 	full (<code>false</code>) build
351
	 * @throws Exception
352
	 */
353
	protected void performDeletionCompatibilityTest(IPath workspaceFile, boolean incremental) throws Exception {
354
			deleteWorkspaceFile(workspaceFile);
355
			if (incremental) {
356
				incrementalBuild();
357
			} else {
358
				fullBuild();
359
			}
360
			ApiProblem[] problems = getEnv().getProblems();
361
			assertProblems(problems);
362
	}	
363
	
364
	/**
365
	 * Performs a compatibility test. The workspace file at the specified (full workspace path)
366
	 * location is created. A build is performed and problems are compared against the expected
367
	 * problems for the associated resource.
368
	 * 
369
	 * @param workspaceFile file to update
370
	 * @param incremental whether to perform an incremental (<code>true</code>) or
371
	 * 	full (<code>false</code>) build
372
	 * @throws Exception
373
	 */
374
	protected void performCreationCompatibilityTest(IPath workspaceFile, boolean incremental) throws Exception {
375
		createWorkspaceFile(
376
				workspaceFile,
377
				getUpdateFilePath(workspaceFile.lastSegment()));
378
		if (incremental) {
379
			incrementalBuild();
380
		} else {
381
			fullBuild();
382
		}
383
		ApiProblem[] problems = getEnv().getProblems();
384
		assertProblems(problems);
385
	}
386
	
387
	/* (non-Javadoc)
388
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#assertProblems(org.eclipse.pde.api.tools.builder.tests.ApiProblem[])
389
	 */
390
	@Override
391
	protected void assertProblems(ApiProblem[] problems) {
392
		super.assertProblems(problems);
393
		int[] expectedProblemIds = getExpectedProblemIds();
394
		int length = problems.length;
395
		if (expectedProblemIds.length != length) {
396
			for (int i = 0; i < length; i++) {
397
				System.err.println(problems[i]);
398
			}
399
		}
400
		assertEquals("Wrong number of problems", expectedProblemIds.length, length);
401
		String[][] args = getExpectedMessageArgs();
402
		if (args != null) {
403
			// compare messages
404
			Set<String> set = new HashSet<String>();
405
			for (int i = 0; i < length; i++) {
406
				set.add(problems[i].getMessage());
407
			}
408
			for (int i = 0; i < expectedProblemIds.length; i++) {
409
				String[] messageArgs = args[i];
410
				int messageId = ApiProblemFactory.getProblemMessageId(expectedProblemIds[i]);
411
				String message = ApiProblemFactory.getLocalizedMessage(messageId, messageArgs);
412
				assertTrue("Missing expected problem: " + message, set.remove(message));
413
			}
414
		} else {
415
			// compare id's
416
			Set<Integer> set = new HashSet<Integer>();
417
			for (int i = 0; i < length; i++) {
418
				set.add(new Integer(problems[i].getProblemId()));
419
			}
420
			for (int i = 0; i < expectedProblemIds.length; i++) {
421
				assertTrue("Missing expected problem: " + expectedProblemIds[i], set.remove(new Integer(expectedProblemIds[i])));
422
			}
423
		}
424
	}
425
	
426
	/**
427
	 * Tests that splitting a plug-in and re-exporting the base is compatible with
428
	 * previous release.
429
	 * 
430
	 * @throws Exception
431
	 */
432
	public void testPluginSplit() throws Exception {
433
		fullBuild();
434
		IMarker[] jdtMarkers = getEnv().getAllJDTMarkers(ResourcesPlugin.getWorkspace().getRoot().getLocation());
435
		int length = jdtMarkers.length;
436
		if (length != 0) {
437
			for (int i = 0; i < length; i++) {
438
				boolean condition = jdtMarkers[i].getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING) == IMarker.SEVERITY_ERROR;
439
				if (condition) {
440
					System.err.println(jdtMarkers[i].getAttribute(IMarker.MESSAGE));
441
				}
442
				assertFalse("Should not be a JDT error", condition);
443
			}
444
		}
445
		ApiProblem[] problems = getEnv().getProblems();
446
		assertProblems(problems);		
447
	}
448
449
	/* (non-Javadoc)
450
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getDefaultProblemId()
451
	 */
452
	@Override
453
	protected int getDefaultProblemId() {
454
		// TODO Auto-generated method stub
455
		return 0;
456
	}
457
458
	/* (non-Javadoc)
459
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getTestSourcePath()
460
	 */
461
	@Override
462
	protected IPath getTestSourcePath() {
463
		// TODO Auto-generated method stub
464
		return null;
465
	}
466
467
	/* (non-Javadoc)
468
	 * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getTestingProjectName()
469
	 */
470
	@Override
471
	protected String getTestingProjectName() {
472
		// TODO Auto-generated method stub
473
		return null;
474
	}
475
	
476
}
(-)test-builder/split/pre-split/a.b.c/src/a/b/c/ClassB.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.b.c;
12
13
/**
14
 *
15
 */
16
public class ClassB {
17
18
	public void methodOne(ClassB arg) {
19
		System.out.println(arg.getClass() + "methodOne()");
20
	}
21
}
(-)test-builder/split/post-split/a.b.c.core/src/d/e/f/ClassE.java (+22 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package d.e.f;
12
13
14
/**
15
 *
16
 */
17
public class ClassE {
18
19
	public void methodOne(ClassE arg) {
20
		System.out.println(arg.getClass() + "methodOne()");
21
	}
22
}
(-)test-builder/split/post-split/a.b.c.core/META-INF/MANIFEST.MF (+8 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Core Plug-in
4
Bundle-SymbolicName: a.b.c.core
5
Bundle-Version: 1.0.0
6
Bundle-RequiredExecutionEnvironment: J2SE-1.5
7
Export-Package: a.b.c,
8
 d.e.f
(-)test-builder/split/pre-split/a.b.c/.settings/org.eclipse.jdt.core.prefs (+8 lines)
Added Link Here
1
#Fri Dec 12 15:24:28 CST 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.compliance=1.5
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
org.eclipse.jdt.core.compiler.source=1.5
(-)test-builder/split/post-split/a.b.c/.settings/org.eclipse.jdt.core.prefs (+8 lines)
Added Link Here
1
#Fri Dec 12 15:24:28 CST 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.compliance=1.5
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
org.eclipse.jdt.core.compiler.source=1.5
(-)test-builder/split/post-split/a.b.c.core/src/a/b/c/ClassB.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.b.c;
12
13
/**
14
 *
15
 */
16
public class ClassB {
17
18
	public void methodOne(ClassB arg) {
19
		System.out.println(arg.getClass() + "methodOne()");
20
	}
21
}
(-)test-builder/split/pre-split/a.b.c/META-INF/MANIFEST.MF (+9 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Test Plug-in
4
Bundle-SymbolicName: a.b.c;singleton:=true
5
Bundle-Version: 1.0.0
6
Bundle-RequiredExecutionEnvironment: J2SE-1.5
7
Bundle-ActivationPolicy: lazy
8
Export-Package: a.b.c,
9
 d.e.f
(-)test-builder/split/post-split/a.b.c/META-INF/MANIFEST.MF (+9 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Test Plug-in
4
Bundle-SymbolicName: a.b.c;singleton:=true
5
Bundle-Version: 1.0.0
6
Bundle-RequiredExecutionEnvironment: J2SE-1.5
7
Bundle-ActivationPolicy: lazy
8
Require-Bundle: a.b.c.core;bundle-version="1.0.0";visibility:=reexport
9
Export-Package: a.b.c
(-)test-builder/split/post-split/a.b.c.core/build.properties (+4 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .
(-)test-builder/split/post-split/a.b.c.core/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)test-builder/split/pre-split/a.b.c/build.properties (+4 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .
(-)test-builder/split/post-split/a.b.c/build.properties (+4 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .
(-)test-builder/split/post-split/a.b.c.core/.project (+34 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>a.b.c.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
		<buildCommand>
24
			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
25
			<arguments>
26
			</arguments>
27
		</buildCommand>
28
	</buildSpec>
29
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
31
		<nature>org.eclipse.jdt.core.javanature</nature>
32
		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
33
	</natures>
34
</projectDescription>
(-)test-builder/split/pre-split/a.b.c/src/d/e/f/ClassD.java (+22 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package d.e.f;
12
13
14
/**
15
 *
16
 */
17
public class ClassD {
18
19
	public void methodOne(ClassD arg) {
20
		System.out.println(arg.getClass() + "methodOne()");
21
	}
22
}
(-)test-builder/split/pre-split/a.b.c/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)test-builder/split/post-split/a.b.c/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)test-builder/split/pre-split/a.b.c/src/d/e/f/ClassE.java (+22 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package d.e.f;
12
13
14
/**
15
 *
16
 */
17
public class ClassE {
18
19
	public void methodOne(ClassE arg) {
20
		System.out.println(arg.getClass() + "methodOne()");
21
	}
22
}
(-)test-builder/split/pre-split/a.b.c/.project (+34 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>a.b.c</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
		<buildCommand>
24
			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
25
			<arguments>
26
			</arguments>
27
		</buildCommand>
28
	</buildSpec>
29
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
31
		<nature>org.eclipse.jdt.core.javanature</nature>
32
		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
33
	</natures>
34
</projectDescription>
(-)test-builder/split/post-split/a.b.c/src/a/b/c/ClassA.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package a.b.c;
12
13
/**
14
 *
15
 */
16
public class ClassA {
17
18
	public void methodOne(ClassA arg) {
19
		System.out.println(arg.getClass() + "methodOne()");
20
	}
21
}
(-)test-builder/split/post-split/a.b.c/.project (+34 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>a.b.c</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
		<buildCommand>
24
			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
25
			<arguments>
26
			</arguments>
27
		</buildCommand>
28
	</buildSpec>
29
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
31
		<nature>org.eclipse.jdt.core.javanature</nature>
32
		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
33
	</natures>
34
</projectDescription>
(-)test-builder/split/post-split/a.b.c.core/.settings/org.eclipse.jdt.core.prefs (+8 lines)
Added Link Here
1
#Fri Dec 12 15:34:46 CST 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.compliance=1.5
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
org.eclipse.jdt.core.compiler.source=1.5
(-)src/org/eclipse/pde/api/tools/internal/provisional/comparator/IDelta.java (-4 / +5 lines)
Lines 921-930 Link Here
921
	public int getModifiers();
921
	public int getModifiers();
922
	
922
	
923
	/**
923
	/**
924
	 * Returns the component id in which the given delta is reported. Might be null if the delta
924
	 * Returns the component identifier including its version identifier in which the given delta is
925
	 * is reported against an api profile.
925
	 * reported, or <code>null</code>. Can be <code>null</code> if the delta is reported against an
926
	 * API profile.
926
	 * 
927
	 * 
927
	 * @return the component id in which the given delta is reported, null if none
928
	 * @return the component id in which the given delta is reported, or <code>null</code> if none
928
	 */
929
	 */
929
	public String getApiComponentID();
930
	public String getComponentVersionId();
930
}
931
}
(-)src/org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator.java (-17 / +57 lines)
Lines 21-26 Link Here
21
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
21
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
22
import org.eclipse.pde.api.tools.internal.provisional.IApiAnnotations;
22
import org.eclipse.pde.api.tools.internal.provisional.IApiAnnotations;
23
import org.eclipse.pde.api.tools.internal.provisional.IApiDescription;
23
import org.eclipse.pde.api.tools.internal.provisional.IApiDescription;
24
import org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription;
24
import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
25
import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
25
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
26
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
26
import org.eclipse.pde.api.tools.internal.provisional.model.ApiScopeVisitor;
27
import org.eclipse.pde.api.tools.internal.provisional.model.ApiScopeVisitor;
Lines 65-71 Link Here
65
			if (version.getMajor() != version2.getMajor()) {
66
			if (version.getMajor() != version2.getMajor()) {
66
				globalDelta.add(
67
				globalDelta.add(
67
					new Delta(
68
					new Delta(
68
						Util.getDeltaComponentID(apiComponent2),
69
						Util.getDeltaComponentVerionsId(apiComponent2),
69
						IDelta.API_COMPONENT_ELEMENT_TYPE,
70
						IDelta.API_COMPONENT_ELEMENT_TYPE,
70
						IDelta.CHANGED,
71
						IDelta.CHANGED,
71
						IDelta.MAJOR_VERSION,
72
						IDelta.MAJOR_VERSION,
Lines 81-87 Link Here
81
			} else if (version.getMinor() != version2.getMinor()) {
82
			} else if (version.getMinor() != version2.getMinor()) {
82
				globalDelta.add(
83
				globalDelta.add(
83
					new Delta(
84
					new Delta(
84
						Util.getDeltaComponentID(apiComponent2),
85
						Util.getDeltaComponentVerionsId(apiComponent2),
85
						IDelta.API_COMPONENT_ELEMENT_TYPE,
86
						IDelta.API_COMPONENT_ELEMENT_TYPE,
86
						IDelta.CHANGED,
87
						IDelta.CHANGED,
87
						IDelta.MINOR_VERSION,
88
						IDelta.MINOR_VERSION,
Lines 367-373 Link Here
367
						IDelta.API_COMPONENT,
368
						IDelta.API_COMPONENT,
368
						null,
369
						null,
369
						component2.getId(),
370
						component2.getId(),
370
						Util.getDeltaComponentID(component2));
371
						Util.getDeltaComponentVerionsId(component2));
371
			} else if (component2 == null) {
372
			} else if (component2 == null) {
372
				String referenceComponentId = referenceComponent.getId();
373
				String referenceComponentId = referenceComponent.getId();
373
				return new Delta(
374
				return new Delta(
Lines 377-383 Link Here
377
						IDelta.API_COMPONENT,
378
						IDelta.API_COMPONENT,
378
						null,
379
						null,
379
						referenceComponentId,
380
						referenceComponentId,
380
						Util.getDeltaComponentID(referenceComponent));
381
						Util.getDeltaComponentVerionsId(referenceComponent));
381
			}
382
			}
382
			String referenceComponentId = referenceComponent.getId();
383
			String referenceComponentId = referenceComponent.getId();
383
			final Delta globalDelta = new Delta();
384
			final Delta globalDelta = new Delta();
Lines 391-397 Link Here
391
				if (!componentsEEs.remove(currentEE)) {
392
				if (!componentsEEs.remove(currentEE)) {
392
					globalDelta.add(
393
					globalDelta.add(
393
							new Delta(
394
							new Delta(
394
									Util.getDeltaComponentID(referenceComponent),
395
									Util.getDeltaComponentVerionsId(referenceComponent),
395
									IDelta.API_COMPONENT_ELEMENT_TYPE,
396
									IDelta.API_COMPONENT_ELEMENT_TYPE,
396
									IDelta.REMOVED,
397
									IDelta.REMOVED,
397
									IDelta.EXECUTION_ENVIRONMENT,
398
									IDelta.EXECUTION_ENVIRONMENT,
Lines 399-412 Link Here
399
									0,
400
									0,
400
									null,
401
									null,
401
									referenceComponentId,
402
									referenceComponentId,
402
									new String[] { currentEE, Util.getDeltaComponentID(referenceComponent)}));
403
									new String[] { currentEE, Util.getDeltaComponentVerionsId(referenceComponent)}));
403
				}
404
				}
404
			}
405
			}
405
			for (Iterator iterator = componentsEEs.iterator(); iterator.hasNext(); ) {
406
			for (Iterator iterator = componentsEEs.iterator(); iterator.hasNext(); ) {
406
				String currentEE = (String) iterator.next();
407
				String currentEE = (String) iterator.next();
407
				globalDelta.add(
408
				globalDelta.add(
408
						new Delta(
409
						new Delta(
409
								Util.getDeltaComponentID(referenceComponent),
410
								Util.getDeltaComponentVerionsId(referenceComponent),
410
								IDelta.API_COMPONENT_ELEMENT_TYPE,
411
								IDelta.API_COMPONENT_ELEMENT_TYPE,
411
								IDelta.ADDED,
412
								IDelta.ADDED,
412
								IDelta.EXECUTION_ENVIRONMENT,
413
								IDelta.EXECUTION_ENVIRONMENT,
Lines 414-420 Link Here
414
								0,
415
								0,
415
								null,
416
								null,
416
								referenceComponentId,
417
								referenceComponentId,
417
								new String[] { currentEE, Util.getDeltaComponentID(referenceComponent)}));
418
								new String[] { currentEE, Util.getDeltaComponentVerionsId(referenceComponent)}));
418
			}
419
			}
419
			return internalCompare(referenceComponent, component2, referenceBaseline, baseline, visibilityModifiers, globalDelta);
420
			return internalCompare(referenceComponent, component2, referenceBaseline, baseline, visibilityModifiers, globalDelta);
420
		} catch(CoreException e) {
421
		} catch(CoreException e) {
Lines 501-507 Link Here
501
			if (refElementDescription != null) {
502
			if (refElementDescription != null) {
502
				refVisibility = refElementDescription.getVisibility();
503
				refVisibility = refElementDescription.getVisibility();
503
			}
504
			}
504
			String deltaComponentID = Util.getDeltaComponentID(component2);
505
			String deltaComponentID = Util.getDeltaComponentVerionsId(component2);
505
			if (typeRoot == null) {
506
			if (typeRoot == null) {
506
				if (isAPI(visibility, typeDescriptor2)) {
507
				if (isAPI(visibility, typeDescriptor2)) {
507
					return new Delta(
508
					return new Delta(
Lines 745-751 Link Here
745
								} else{
746
								} else{
746
									typeRoot2 = component2.findTypeRoot(typeName, id);
747
									typeRoot2 = component2.findTypeRoot(typeName, id);
747
								}
748
								}
748
								String deltaComponentID = Util.getDeltaComponentID(component2);
749
								String deltaComponentID = null;
750
								IApiComponent provider = null;
751
								IApiDescription providerApiDesc = null;
752
								boolean reexported = false;
753
								if (typeRoot2 == null) {
754
									// check if the type is provided by a required component (it could have been moved/re-exported)
755
									IApiComponent[] providers = component2.getBaseline().resolvePackage(component2, packageName);
756
									int index = 0;
757
									while (typeRoot2 == null && index < providers.length) {
758
										IApiComponent p = providers[index];
759
										if (!p.equals(component2)) {
760
											typeRoot2 = p.findTypeRoot(typeName, p.getId());
761
											if (typeRoot2 != null) {
762
												provider = p;
763
												providerApiDesc = p.getApiDescription();
764
												IRequiredComponentDescription[] required = component2.getRequiredComponents();
765
												for (int k = 0; k < required.length; k++) {
766
													IRequiredComponentDescription description = required[k];
767
													if (description.getId().equals(p.getId())) {
768
														reexported = description.isExported();
769
														break;
770
													}
771
												}
772
											}
773
										}
774
										index++;
775
									}
776
								} else {
777
									provider = component2;
778
									providerApiDesc = apiDescription2;
779
								}
780
								if (provider == null) {
781
									deltaComponentID = Util.getDeltaComponentVerionsId(component2);
782
								} else {
783
									deltaComponentID = Util.getDeltaComponentVerionsId(provider);
784
								}
749
								if(typeRoot2 == null) {
785
								if(typeRoot2 == null) {
750
									if ((visibility & visibilityModifiers) == 0) {
786
									if ((visibility & visibilityModifiers) == 0) {
751
										// we skip the class file according to their visibility
787
										// we skip the class file according to their visibility
Lines 775-781 Link Here
775
										return;
811
										return;
776
									}
812
									}
777
									IApiType typeDescriptor2 = typeRoot2.getStructure();
813
									IApiType typeDescriptor2 = typeRoot2.getStructure();
778
									IApiAnnotations elementDescription2 = apiDescription2.resolveAnnotations(typeDescriptor2.getHandle());
814
									IApiAnnotations elementDescription2 = providerApiDesc.resolveAnnotations(typeDescriptor2.getHandle());
779
									int visibility2 = 0;
815
									int visibility2 = 0;
780
									if (elementDescription2 != null) {
816
									if (elementDescription2 != null) {
781
										visibility2 = elementDescription2.getVisibility();
817
										visibility2 = elementDescription2.getVisibility();
Lines 787-795 Link Here
787
											return;
823
											return;
788
										}
824
										}
789
									}
825
									}
790
									if (isAPI(visibility, typeDescriptor) && !isAPI(visibility2, typeDescriptor2)) {
826
									if (isAPI(visibility, typeDescriptor)) {
791
										globalDelta.add(
827
										if (!isAPI(visibility2, typeDescriptor2) || (!provider.equals(component2) && !reexported)) {
792
												new Delta(
828
											if (!isAPI(visibility2, typeDescriptor2)) {
829
												globalDelta.add(
830
													new Delta(
793
														deltaComponentID,
831
														deltaComponentID,
794
														IDelta.API_COMPONENT_ELEMENT_TYPE,
832
														IDelta.API_COMPONENT_ELEMENT_TYPE,
795
														IDelta.REMOVED,
833
														IDelta.REMOVED,
Lines 799-805 Link Here
799
														typeName,
837
														typeName,
800
														typeName,
838
														typeName,
801
														new String[] { typeName, deltaComponentID}));
839
														new String[] { typeName, deltaComponentID}));
802
										return;
840
												return;
841
											}
842
										}
803
									}
843
									}
804
									if ((visibility2 & visibilityModifiers) == 0) {
844
									if ((visibility2 & visibilityModifiers) == 0) {
805
										// we simply report a changed visibility
845
										// we simply report a changed visibility
Lines 816-822 Link Here
816
														new String[] { typeName, deltaComponentID}));
856
														new String[] { typeName, deltaComponentID}));
817
									}
857
									}
818
									typeRootBaseLineNames.add(typeName);
858
									typeRootBaseLineNames.add(typeName);
819
									ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, component, component2, referenceBaseline, baseline, visibilityModifiers);
859
									ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, component, provider, referenceBaseline, baseline, visibilityModifiers);
820
									IDelta delta = comparator.getDelta();
860
									IDelta delta = comparator.getDelta();
821
									IStatus status = comparator.getStatus();
861
									IStatus status = comparator.getStatus();
822
									if(status != null) {
862
									if(status != null) {
Lines 858-864 Link Here
858
									return;
898
									return;
859
								}
899
								}
860
								typeRootBaseLineNames.add(typeName);
900
								typeRootBaseLineNames.add(typeName);
861
								String deltaComponentID = Util.getDeltaComponentID(component2);
901
								String deltaComponentID = Util.getDeltaComponentVerionsId(component2);
862
								globalDelta.add(
902
								globalDelta.add(
863
										new Delta(
903
										new Delta(
864
												deltaComponentID,
904
												deltaComponentID,
(-)src/org/eclipse/pde/api/tools/internal/comparator/DeltaXmlVisitor.java (-1 / +1 lines)
Lines 73-79 Link Here
73
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_COMPATIBLE, Boolean.toString(DeltaProcessor.isCompatible(delta)));
73
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_COMPATIBLE, Boolean.toString(DeltaProcessor.isCompatible(delta)));
74
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_MODIFIERS, Integer.toString(delta.getModifiers()));
74
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_MODIFIERS, Integer.toString(delta.getModifiers()));
75
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_RESTRICTIONS, Integer.toString(delta.getRestrictions()));
75
		deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_RESTRICTIONS, Integer.toString(delta.getRestrictions()));
76
		String apiComponentID = delta.getApiComponentID();
76
		String apiComponentID = delta.getComponentVersionId();
77
		if (apiComponentID != null) {
77
		if (apiComponentID != null) {
78
			deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_COMPONENT_ID, apiComponentID);
78
			deltaElement.setAttribute(IApiXmlConstants.ATTR_NAME_COMPONENT_ID, apiComponentID);
79
		}
79
		}
(-)src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java (-11 / +11 lines)
Lines 160-169 Link Here
160
		this.delta.add(delta);
160
		this.delta.add(delta);
161
	}
161
	}
162
	private void addDelta(int elementType, int kind, int flags, int restrictions, int modifiers, IApiType type, String key, String data) {
162
	private void addDelta(int elementType, int kind, int flags, int restrictions, int modifiers, IApiType type, String key, String data) {
163
		this.addDelta(new Delta(Util.getDeltaComponentID(this.component2), elementType, kind, flags, restrictions, modifiers, type.getName(), key, data));
163
		this.addDelta(new Delta(Util.getDeltaComponentVerionsId(this.component2), elementType, kind, flags, restrictions, modifiers, type.getName(), key, data));
164
	}
164
	}
165
	private void addDelta(int elementType, int kind, int flags, int restrictions, int modifiers, IApiType type, String key, String[] datas) {
165
	private void addDelta(int elementType, int kind, int flags, int restrictions, int modifiers, IApiType type, String key, String[] datas) {
166
		this.addDelta(new Delta(Util.getDeltaComponentID(this.component2), elementType, kind, flags, restrictions, modifiers, type.getName(), key, datas));
166
		this.addDelta(new Delta(Util.getDeltaComponentVerionsId(this.component2), elementType, kind, flags, restrictions, modifiers, type.getName(), key, datas));
167
	}
167
	}
168
	/**
168
	/**
169
	 * Checks if the super-class set has been change in any way compared to the baseline (grown or reduced or types changed)
169
	 * Checks if the super-class set has been change in any way compared to the baseline (grown or reduced or types changed)
Lines 470-476 Link Here
470
								typeMember.getModifiers(),
470
								typeMember.getModifiers(),
471
								this.type1,
471
								this.type1,
472
								typeMember.getName(),
472
								typeMember.getName(),
473
								new String[] { typeMember.getName().replace('$', '.'), Util.getDeltaComponentID(component2)});
473
								new String[] { typeMember.getName().replace('$', '.'), Util.getDeltaComponentVerionsId(component2)});
474
					} catch (CoreException e) {
474
					} catch (CoreException e) {
475
						reportStatus(e);
475
						reportStatus(e);
476
					}
476
					}
Lines 505-511 Link Here
505
						if (memberTypeElementDescription2 != null) {
505
						if (memberTypeElementDescription2 != null) {
506
							memberTypeVisibility2 = memberTypeElementDescription2.getVisibility();
506
							memberTypeVisibility2 = memberTypeElementDescription2.getVisibility();
507
						}
507
						}
508
						String deltaComponentID = Util.getDeltaComponentID(component2);
508
						String deltaComponentID = Util.getDeltaComponentVerionsId(component2);
509
						int restrictions = memberTypeElementDescription2 != null ? memberTypeElementDescription2.getRestrictions() : RestrictionModifiers.NO_RESTRICTIONS;
509
						int restrictions = memberTypeElementDescription2 != null ? memberTypeElementDescription2.getRestrictions() : RestrictionModifiers.NO_RESTRICTIONS;
510
						if (Util.isFinal(this.type2.getModifiers())) {
510
						if (Util.isFinal(this.type2.getModifiers())) {
511
							restrictions |= RestrictionModifiers.NO_EXTEND;
511
							restrictions |= RestrictionModifiers.NO_EXTEND;
Lines 585-591 Link Here
585
							typeMember.getModifiers(),
585
							typeMember.getModifiers(),
586
							this.type1,
586
							this.type1,
587
							typeMember.getName(),
587
							typeMember.getName(),
588
							new String[] { typeMember.getName().replace('$', '.'), Util.getDeltaComponentID(component2)});
588
							new String[] { typeMember.getName().replace('$', '.'), Util.getDeltaComponentVerionsId(component2)});
589
				} catch (CoreException e) {
589
				} catch (CoreException e) {
590
					reportStatus(e);
590
					reportStatus(e);
591
				}
591
				}
Lines 1005-1012 Link Here
1005
									IDelta.RESTRICTIONS,
1005
									IDelta.RESTRICTIONS,
1006
									restrictions2,
1006
									restrictions2,
1007
									typeAccess,
1007
									typeAccess,
1008
									this.type1,
1008
									this.type2,
1009
									this.type1.getName(),
1009
									this.type2.getName(),
1010
									Util.getDescriptorName(type1));
1010
									Util.getDescriptorName(type1));
1011
							}
1011
							}
1012
						} else {
1012
						} else {
Lines 1021-1028 Link Here
1021
											IDelta.RESTRICTIONS,
1021
											IDelta.RESTRICTIONS,
1022
											restrictions2,
1022
											restrictions2,
1023
											typeAccess,
1023
											typeAccess,
1024
											this.type1,
1024
											this.type2,
1025
											this.type1.getName(),
1025
											this.type2.getName(),
1026
											Util.getDescriptorName(type1));
1026
											Util.getDescriptorName(type1));
1027
								}
1027
								}
1028
							}
1028
							}
Lines 1037-1044 Link Here
1037
											IDelta.RESTRICTIONS,
1037
											IDelta.RESTRICTIONS,
1038
											restrictions2,
1038
											restrictions2,
1039
											typeAccess,
1039
											typeAccess,
1040
											this.type1,
1040
											this.type2,
1041
											this.type1.getName(),
1041
											this.type2.getName(),
1042
											Util.getDescriptorName(type1));
1042
											Util.getDescriptorName(type1));
1043
								}
1043
								}
1044
							}
1044
							}
(-)src/org/eclipse/pde/api/tools/internal/comparator/Delta.java (-1 / +1 lines)
Lines 210-216 Link Here
210
		return true;
210
		return true;
211
	}
211
	}
212
	
212
	
213
	public String getApiComponentID() {
213
	public String getComponentVersionId() {
214
		return this.componentID;
214
		return this.componentID;
215
	}
215
	}
216
216
(-)src_ant/org/eclipse/pde/api/tools/internal/tasks/ExcludeListDeltaVisitor.java (-1 / +1 lines)
Lines 58-64 Link Here
58
	private boolean isExcluded(IDelta delta) {
58
	private boolean isExcluded(IDelta delta) {
59
		String typeName = delta.getTypeName();
59
		String typeName = delta.getTypeName();
60
		StringBuffer buffer = new StringBuffer();
60
		StringBuffer buffer = new StringBuffer();
61
		String componentId = delta.getApiComponentID();
61
		String componentId = delta.getComponentVersionId();
62
		if (componentId != null) {
62
		if (componentId != null) {
63
			buffer.append(componentId).append(':');
63
			buffer.append(componentId).append(':');
64
		}
64
		}
(-)src/org/eclipse/pde/api/tools/internal/builder/BuildState.java (-1 / +1 lines)
Lines 108-114 Link Here
108
	private static void writeDelta(IDelta delta, DataOutputStream out) throws IOException {
108
	private static void writeDelta(IDelta delta, DataOutputStream out) throws IOException {
109
		// encode a delta into the build state
109
		// encode a delta into the build state
110
		// int elementType, int kind, int flags, int restrictions, int modifiers, String typeName, String key, Object data
110
		// int elementType, int kind, int flags, int restrictions, int modifiers, String typeName, String key, Object data
111
		String apiComponentID = delta.getApiComponentID();
111
		String apiComponentID = delta.getComponentVersionId();
112
		boolean hasComponentID = apiComponentID != null;
112
		boolean hasComponentID = apiComponentID != null;
113
		out.writeBoolean(hasComponentID);
113
		out.writeBoolean(hasComponentID);
114
		if (hasComponentID) {
114
		if (hasComponentID) {
(-)src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java (-1 / +1 lines)
Lines 810-816 Link Here
810
							return;
810
							return;
811
						}
811
						}
812
						if (VisibilityModifiers.isAPI(visibility)) {
812
						if (VisibilityModifiers.isAPI(visibility)) {
813
							String deltaComponentID = Util.getDeltaComponentID(reference);
813
							String deltaComponentID = Util.getDeltaComponentVerionsId(reference);
814
							delta = new Delta(
814
							delta = new Delta(
815
									deltaComponentID,
815
									deltaComponentID,
816
									IDelta.API_COMPONENT_ELEMENT_TYPE,
816
									IDelta.API_COMPONENT_ELEMENT_TYPE,
(-)src/org/eclipse/pde/api/tools/internal/util/Util.java (-1 / +8 lines)
Lines 2472-2478 Link Here
2472
		return set;
2472
		return set;
2473
	}
2473
	}
2474
2474
2475
	public static String getDeltaComponentID(IApiComponent component) {
2475
	/**
2476
	 * Returns an identifier for the given API component including its version identifier
2477
	 * (component id + _ + major + _ + minor + _ + micro)
2478
	 *  
2479
	 * @param component API component
2480
	 * @return API component + version identifier
2481
	 */
2482
	public static String getDeltaComponentVerionsId(IApiComponent component) {
2476
		try {
2483
		try {
2477
			StringBuffer buffer = new StringBuffer(component.getId());
2484
			StringBuffer buffer = new StringBuffer(component.getId());
2478
			String version = component.getVersion();
2485
			String version = component.getVersion();

Return to bug 240914