John E. Conlon wrote:
On Mon, 2006-04-10 at 06:21 -0400, Richard S. Hall wrote:
Or are you referring to a situation where you are running
into the bug I mentioned where your bundle does not directly use these
classes but you are still getting a class loading error?
Depends what you mean by directly.
My issue has to do with only some com.sun.* packages. Specifically
swing plf packages. I misspoke on the previous email although I
mentioned sun.* classes I am not doing anything with them and did not
have to import these into my bundles.
In the case of these swing plf classes I don't import these classes and
use them directly but I do use strings to send them to a public
(factory) class for loading.
Here is how I am using the Swing plugable look and feel classes to give
the user of the GUI an option to load alternatives look and feels:
// Possible Look & Feels
private static final String mac =
"com.sun.java.swing.plaf.mac.MacLookAndFeel";
private static final String metal =
"javax.swing.plaf.metal.MetalLookAndFeel";
private static final String motif =
"com.sun.java.swing.plaf.motif.MotifLookAndFeel";
private static final String windows =
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
private static final String gtk =
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
// This eventual leads to a change an action that changes
// the look and feel with the following:
String currentLookAndFeel=metal;
javax.swing.UIManager.setLookAndFeel(currentLookAndFeel);
Well, from my point of view, it definitely looks as if there is a
dependency, but I understand your dilemma since this is the way Sun
tells us to do things.
However, looking at this code, I would think that it wouldn't cause a
problem, because my "check" for implicit parent delegation in this case
should find javax.swing.UIManager on the class context stack and it
would know that this class was not loaded from a bundle, thus it would
delegate the class load request to the parent class loader. I would
really be interested in seeing a sample bundle of this if you could send
me something.
I have committed support for the boot delegation property and have added
com.sun.* and sun.* to it in config.properties by default. It is my
belief that we should be careful to not get too liberal with boot
delegation since it really breaks modularity.
The best situation would be if we could learn to detect when to delegate
to the parent and when not to, which is why examples of the situation
are helpful...maybe I will write another message about this topic when I
have time.
-> richard