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.startsWith(FRAGMENT);
52
				if (entry != null) {
53
				if (fromFragment)
53
					cpEntries.add(entry);
54
					devCP = devCP.substring(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 / +8 lines)
Lines 311-317 Link Here
311
					}
311
					}
312
					IPath[] paths = findLibrary(libName, project, classpathMap, build);
312
					IPath[] paths = findLibrary(libName, project, classpathMap, build);
313
					if (paths.length > 0)
313
					if (paths.length > 0)
314
						return paths;
314
						return prefixFragmentAnnotation(paths);
315
315
316
				} catch (JavaModelException e) {
316
				} catch (JavaModelException e) {
317
					continue;
317
					continue;
Lines 322-334 Link Here
322
				if (file.isDirectory()) {
322
				if (file.isDirectory()) {
323
					file = new File(file, libName);
323
					file = new File(file, libName);
324
					if (file.exists())
324
					if (file.exists())
325
						return new IPath[] {new Path(file.getPath())};
325
						return new IPath[] {new Path("@fragment@" + file.getPath())};
326
				}
326
				}
327
			}
327
			}
328
		}
328
		}
329
		return new IPath[0];
329
		return new IPath[0];
330
	}
330
	}
331
331
332
	private static IPath[] prefixFragmentAnnotation(IPath[] paths) {
333
		for (int i = 0; i < paths.length; i++)
334
			paths[i] = new Path("@fragment@" + paths[i].toString());
335
		return paths;
336
	}
337
332
	private static void addPath(ArrayList result, IProject project, IPath path) {
338
	private static void addPath(ArrayList result, IProject project, IPath path) {
333
		IPath resultPath = null;
339
		IPath resultPath = null;
334
		if (path.isAbsolute())
340
		if (path.isAbsolute())

Return to bug 294211