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/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
}
(-)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
}
(-)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/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/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/.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/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.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/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/ApiComparator.java (-6 / +42 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 746-751 Link Here
746
									typeRoot2 = component2.findTypeRoot(typeName, id);
747
									typeRoot2 = component2.findTypeRoot(typeName, id);
747
								}
748
								}
748
								String deltaComponentID = Util.getDeltaComponentID(component2);
749
								String deltaComponentID = Util.getDeltaComponentID(component2);
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
								}
749
								if(typeRoot2 == null) {
780
								if(typeRoot2 == null) {
750
									if ((visibility & visibilityModifiers) == 0) {
781
									if ((visibility & visibilityModifiers) == 0) {
751
										// we skip the class file according to their visibility
782
										// we skip the class file according to their visibility
Lines 775-781 Link Here
775
										return;
806
										return;
776
									}
807
									}
777
									IApiType typeDescriptor2 = typeRoot2.getStructure();
808
									IApiType typeDescriptor2 = typeRoot2.getStructure();
778
									IApiAnnotations elementDescription2 = apiDescription2.resolveAnnotations(typeDescriptor2.getHandle());
809
									IApiAnnotations elementDescription2 = providerApiDesc.resolveAnnotations(typeDescriptor2.getHandle());
779
									int visibility2 = 0;
810
									int visibility2 = 0;
780
									if (elementDescription2 != null) {
811
									if (elementDescription2 != null) {
781
										visibility2 = elementDescription2.getVisibility();
812
										visibility2 = elementDescription2.getVisibility();
Lines 787-795 Link Here
787
											return;
818
											return;
788
										}
819
										}
789
									}
820
									}
790
									if (isAPI(visibility, typeDescriptor) && !isAPI(visibility2, typeDescriptor2)) {
821
									if (isAPI(visibility, typeDescriptor)) {
791
										globalDelta.add(
822
										// ensure type is still API and is re-exported if from required bundle
792
												new Delta(
823
										if (!isAPI(visibility2, typeDescriptor2) || (!provider.equals(component2) && !reexported)) {
824
											if (!isAPI(visibility2, typeDescriptor2)) {
825
												globalDelta.add(
826
													new Delta(
793
														deltaComponentID,
827
														deltaComponentID,
794
														IDelta.API_COMPONENT_ELEMENT_TYPE,
828
														IDelta.API_COMPONENT_ELEMENT_TYPE,
795
														IDelta.REMOVED,
829
														IDelta.REMOVED,
Lines 799-805 Link Here
799
														typeName,
833
														typeName,
800
														typeName,
834
														typeName,
801
														new String[] { typeName, deltaComponentID}));
835
														new String[] { typeName, deltaComponentID}));
802
										return;
836
												return;
837
											}
838
										}
803
									}
839
									}
804
									if ((visibility2 & visibilityModifiers) == 0) {
840
									if ((visibility2 & visibilityModifiers) == 0) {
805
										// we simply report a changed visibility
841
										// we simply report a changed visibility
Lines 816-822 Link Here
816
														new String[] { typeName, deltaComponentID}));
852
														new String[] { typeName, deltaComponentID}));
817
									}
853
									}
818
									typeRootBaseLineNames.add(typeName);
854
									typeRootBaseLineNames.add(typeName);
819
									ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, component, component2, referenceBaseline, baseline, visibilityModifiers);
855
									ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, component, provider, referenceBaseline, baseline, visibilityModifiers);
820
									IDelta delta = comparator.getDelta();
856
									IDelta delta = comparator.getDelta();
821
									IStatus status = comparator.getStatus();
857
									IStatus status = comparator.getStatus();
822
									if(status != null) {
858
									if(status != null) {

Return to bug 240914