Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 43658 - [migration] Plug-ins hosting classpath entries for fragments
Summary: [migration] Plug-ins hosting classpath entries for fragments
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Incubator (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: User Unknown CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-25 11:01 EDT by Jeff McAffer CLA
Modified: 2005-09-27 09:12 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2003-09-25 11:01:11 EDT
Who is affected: Plug-ins which declare classpath entries in their plugin.xml 
file but where the actual jars are intended to be supplied by fragments to the 
plug-in. 

Description: Standard Eclipse manages fragments by seamlessly merging the 
entries in their fragment.xml files with those of the host plug-in's plugin.xml 
file. For example, at runtime only the host has a classloader. This classloader 
loads the classes from the plug-in as well as all the fragments. This leads to 
situations where the host specifies a classpath entry such as "$ws$/swt.jar" 
but does not in face supply the swt.jar.

The new fragment model sees fragments as first class entities which have 
classloaders of their own (if needed) but yet delegate class/resource discovery 
to the classloader of their host prior to consulting their own classpath. This 
is functionally equivalent to the standard Eclipse approach but leads to a 
difference in the classpath setup. Under this model, there is no reason for the 
host to specify a vacuous classpath entry. Rather, it should remain silent 
about jars potentially supplied by fragments and leave them to specify their 
own classpath.

Analysis: The current Eclipse behaviour is somewhat anomalous in that the 
runtime and the tooling have to take exceptional measures when computing the 
classpath related to a set of fragments and their host plug-in. The new 
approach simplifies this. 

The only place where we have seen this issue is in the SWT plug-in and 
fragments. The unfortunate side-effect of this change is that it makes it hard 
to generate the bundle manifests corresponding to the plugin.xml and 
fragment.xmls. The current Equinox runtime relies on the SWT elements including 
hand-crafted manifest files with the characteristics outlined above. 

Technical notes: The Equinox team is investigating enhancing the plug-in 
converter to analyze potential cases and generate the appropriate classpath 
entries in the bundle and fragment manifests.
Comment 1 Jeff McAffer CLA 2003-10-07 11:01:36 EDT
see also bug 44230

As stated in bug 44230, the Equinox behviour described in comment 1 is not 
functionally equivalent.  Code from a fragment cannot see package visible code 
in the same package but in the plugin.  This is because the two packages are 
loaded by different classloaders and so are in fact different packages.

The migration doc will be updated to reflect this.

The only reasonable workaround we can see at this time is to change the 
implementation of fragments to put their code elements on the host's 
classloader.  This matches the Eclipse behaviour, reduced classloader cycles 
but also couples fragments and hosts more tightly.
 
Comment 2 Jeff McAffer CLA 2003-11-26 09:25:42 EST
The fragment model has been updated and fragments are now merged onto their 
hosts.  Closing.