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 NoClassDefFoundErrors, 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 to org.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 the MANIFEST.MF of org.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.
Are there any objections, or can I just add that line of code to org.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 have org.strategoxt.imp.runtime open in my workspace.

Submitted by Oskar van Rest on 8 May 2012 at 05:25

On 8 May 2012 at 14:00 Lennart Kats commented:

If this works after deployment, it may be possible to combine it with the patch of Spoofax/322 that only works before deployment.


On 9 May 2012 at 04:34 Oskar van Rest commented:

added it to Spoofax, and it works after deployment :)


On 9 May 2012 at 11:41 Lennart Kats commented:

So, did you try the other fix? Does it work before deployment as well then?


On 10 May 2012 at 07:30 Oskar van Rest commented:

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?


On 10 May 2012 at 13:52 Lennart Kats commented:

It puts all plugins in plugin.xml on your classpath. That makes it possible to directly use third-party plugins like EMF.


On 11 May 2012 at 10:59 Oskar van Rest tagged 1.1

On 11 May 2012 at 10:59 Oskar van Rest tagged @oskarvanrest

On 11 May 2012 at 11:01 Oskar van Rest commented:

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).


On 11 May 2012 at 11:02 Oskar van Rest commented:

fixed in revision r24813+r24820


On 11 May 2012 at 11:02 Oskar van Rest closed this issue.

On 8 January 2013 at 17:32 Gabriël Konat tagged 1.1

Log in to post comments