Buddy Class Loading
I just came across this concept of Buddy Class Loading and think this might be a nice improvement for Spoofax.
Let’s say you have a Spoofax project with Java strategies that make calls to other plugins (either installed plugins or plugins from your workspace). Spoofax won’t dynamically load these other plugins, but you just want to test your language by running a new Eclipse Application instead. Currently, this gives
NoClassDefFoundError
s, even though you added dependencies from you Spoofax project to these other plugins.To make it work, you have to add the same dependencies to
org.strategoxt.imp.runtime
as well, which isn’t what we want (in my case, I need dependencies to EMF and GMF, but adding these toorg.strategoxt.imp.runtime
would require every Spoofax user to have EMF and GMF installed).I think what we want is that we only have to add the dependencies to the Spoofax project and not to
org.strategoxt.imp.runtime
. Buddy Class Loading can make that work by simply adding the following line of code to theMANIFEST.MF
oforg.strategoxt.imp.runtime
:Eclipse-BuddyPolicy: registered
Then, users that want dependencies to other plugins, only have to add the following code to their own Spoofax project:
Eclipse-RegisterBuddy: org.strategoxt.imp.runtime
and add the dependencies to their Spoofax project.
Submitted by Oskar van Rest on 8 May 2012 at 05:25
Are there any objections, or can I just add that line of code toorg.strategoxt.imp.runtime
?
I haven’t been able to test if it still works after deployment though, because I can’t seem to deploy my plugin if I haveorg.strategoxt.imp.runtime
open in my workspace.
Issue Log
If this works after deployment, it may be possible to combine it with the patch of Spoofax/322 that only works before deployment.
added it to Spoofax, and it works after deployment :)
So, did you try the other fix? Does it work before deployment as well then?
I’m not sure what this other fix does. Is that for .jar files that you add as provider to YourLang-Builders.esv? Because that seems to work fine without that fix too. Or is it supposed to dynamically load plugins that you depend on in your plugin.xml?
It puts all plugins in
plugin.xml
on your classpath. That makes it possible to directly use third-party plugins like EMF.
there was some misunderstanding between Lennart and me, but Buddy Classloading works both before and after deployment (but you’ll have to work with two Eclipse instances before deployment).
fixed in revision r24813+r24820
Log in to post comments