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

Collapse All | Expand All

(-)defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/DevClassLoadingHook.java (-7 / +15 lines)
Lines 26-31 Link Here
26
public class DevClassLoadingHook implements ClassLoadingHook, HookConfigurator, KeyedElement {
26
public class DevClassLoadingHook implements ClassLoadingHook, HookConfigurator, KeyedElement {
27
	public static final String KEY = DevClassLoadingHook.class.getName();
27
	public static final String KEY = DevClassLoadingHook.class.getName();
28
	public static final int HASHCODE = KEY.hashCode();
28
	public static final int HASHCODE = KEY.hashCode();
29
	private static final String FRAGMENT = "@fragment@"; //$NON-NLS-1$
29
30
30
	public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) {
31
	public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) {
31
		// Do nothing
32
		// Do nothing
Lines 47-57 Link Here
47
			else {
48
			else {
48
				// if in dev mode, try using the cp as an absolute path
49
				// if in dev mode, try using the cp as an absolute path
49
				// we assume absolute entries come from fragments.  Find the source
50
				// we assume absolute entries come from fragments.  Find the source
50
				BaseData fragData = findFragmentSource(sourcedata, devClassPath[i], hostmanager);
51
				String devCP = devClassPath[i];
51
				ClasspathEntry entry = hostmanager.getExternalClassPath(devClassPath[i], fragData, sourcedomain);
52
				boolean fromFragment = devCP.endsWith(FRAGMENT);
52
				if (entry != null) {
53
				if (fromFragment)
53
					cpEntries.add(entry);
54
					devCP = devCP.substring(0, devCP.length() - FRAGMENT.length());
54
					result = true;
55
				BaseData fragData = findFragmentSource(sourcedata, devCP, hostmanager, fromFragment);
56
				if (fragData != null) {
57
					ClasspathEntry entry = hostmanager.getExternalClassPath(devCP, fragData, sourcedomain);
58
					if (entry != null) {
59
						cpEntries.add(entry);
60
						result = true;
61
					}
55
				}
62
				}
56
			}
63
			}
57
		}
64
		}
Lines 62-70 Link Here
62
		return result;
69
		return result;
63
	}
70
	}
64
71
65
	private BaseData findFragmentSource(BaseData hostData, String cp, ClasspathManager manager) {
72
	private BaseData findFragmentSource(BaseData hostData, String cp, ClasspathManager manager, boolean fromFragment) {
66
		if (hostData != manager.getBaseData())
73
		if (hostData != manager.getBaseData())
67
			return hostData;
74
			return hostData;
75
68
		File file = new File(cp);
76
		File file = new File(cp);
69
		if (!file.isAbsolute())
77
		if (!file.isAbsolute())
70
			return hostData;
78
			return hostData;
Lines 75-81 Link Here
75
			if (fragFile != null && file.getPath().startsWith(fragFile.getPath()))
83
			if (fragFile != null && file.getPath().startsWith(fragFile.getPath()))
76
				return fragCP[i].getBundleData();
84
				return fragCP[i].getBundleData();
77
		}
85
		}
78
		return hostData;
86
		return fromFragment ? null : hostData;
79
	}
87
	}
80
88
81
	public String findLibrary(BaseData data, String libName) {
89
	public String findLibrary(BaseData data, String libName) {
(-)src/org/eclipse/pde/internal/core/ClasspathHelper.java (-2 / +14 lines)
Lines 25-30 Link Here
25
public class ClasspathHelper {
25
public class ClasspathHelper {
26
26
27
	private static final String DOT = "."; //$NON-NLS-1$
27
	private static final String DOT = "."; //$NON-NLS-1$
28
	private static final String FRAGMENT_ANNOTATION = "@fragment@"; //$NON-NLS-1$
28
29
29
	public static String getDevEntriesProperties(String fileName, boolean checkExcluded) {
30
	public static String getDevEntriesProperties(String fileName, boolean checkExcluded) {
30
		File file = new File(fileName);
31
		File file = new File(fileName);
Lines 311-317 Link Here
311
					}
312
					}
312
					IPath[] paths = findLibrary(libName, project, classpathMap, build);
313
					IPath[] paths = findLibrary(libName, project, classpathMap, build);
313
					if (paths.length > 0)
314
					if (paths.length > 0)
314
						return paths;
315
						return postfixFragmentAnnotation(paths);
315
316
316
				} catch (JavaModelException e) {
317
				} catch (JavaModelException e) {
317
					continue;
318
					continue;
Lines 322-334 Link Here
322
				if (file.isDirectory()) {
323
				if (file.isDirectory()) {
323
					file = new File(file, libName);
324
					file = new File(file, libName);
324
					if (file.exists())
325
					if (file.exists())
325
						return new IPath[] {new Path(file.getPath())};
326
						// Postfix fragment annotation for fragment path (fix bug 294211)
327
						return new IPath[] {new Path(file.getPath() + FRAGMENT_ANNOTATION)};
326
				}
328
				}
327
			}
329
			}
328
		}
330
		}
329
		return new IPath[0];
331
		return new IPath[0];
330
	}
332
	}
331
333
334
	/*
335
	 * Postfixes the fragment annotation for the paths that we know come
336
	 * from fragments.  This is needed to fix bug 294211.
337
	 */
338
	private static IPath[] postfixFragmentAnnotation(IPath[] paths) {
339
		for (int i = 0; i < paths.length; i++)
340
			paths[i] = new Path(paths[i].toString() + FRAGMENT_ANNOTATION);
341
		return paths;
342
	}
343
332
	private static void addPath(ArrayList result, IProject project, IPath path) {
344
	private static void addPath(ArrayList result, IProject project, IPath path) {
333
		IPath resultPath = null;
345
		IPath resultPath = null;
334
		if (path.isAbsolute())
346
		if (path.isAbsolute())

Return to bug 294211