| Class loading in SWT Event Thread [message #1124378] |
Thu, 03 October 2013 09:24  |
Jan Krakora Messages: 432 Registered: December 2009 Location: Prague |
Senior Member |
|
|
I'm little confused about class loading in the Eclipse runtime.
I have my own plugin that uses this code:
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MyClass class = new MyClass();
....
}
)};
Since the code in run() is executed on the SWT Event thread, I would like to know what class loader will be used for loading the MyClass.class.
|
|
|
|
| Re: Class loading in SWT Event Thread [message #1125152 is a reply to message #1125078] |
Fri, 04 October 2013 03:55   |
Jan Krakora Messages: 432 Registered: December 2009 Location: Prague |
Senior Member |
|
|
Well, my problem is in using lambdaj on the SWT Event thread.
Let's say I have:
- plugin A containing MyClass
- plugin B containing ByClassB that define the code below
- com.google.lambdaj plugin
- plugin B has dependency on plugin com.google.lambdaj
- plugin B has also dependency on plugin A, so it can use its MyClass
lambdaj internally uses the cglib to create proxy classes. So when I have something like this:
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MyClass class = Lambda.selectFirst(collection, having(on(MyClass.class).getId(), Matchers.equalTo(id)));
....
}
)};
I get "java.lang.ClassNotFoundException: net.sf.cglib.proxy.Factory". When I debug it and look at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(...),
I can see the plugin that is looking for the net.sf.cglib.proxy.Factory class is the A plugin.
Since I can't modify the com.google.lambdaj plugin, the only workaround was to put Eclipse-BuddyPolicy: global in my A plugin.
This is AFAIK bad solution because it then looks for the class in all exported packages from the whole RCP application.
The fact that my code runs on the SWT Event thread is maybe irrelevant.
[Updated on: Fri, 04 October 2013 04:06] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01803 seconds