7

This is my situation: We have a third party feature in our Eclipse environment. The feature contains several plugins. The plugin contains a bunch of classes. One of the classes contains a bug.

We have been able to find a solution to the bug, so we have a working version of the class with the bug.

Unfortunately this plugin is covered by a 55 page long EULA (by IBM) so I think it's pretty safe to assume that decompiling the jar, exchanging class files, recompiling and distribute is legally out of the question. I'm no legal expert, but I'd guess we cannot tamper with the jar files in any way.

So this means I have a single class file that I want to be loaded instead of a class in a plugin, is this at all possible?

This page suggests using fragments, but this requires modifying the manifest in the plugin.

This question has the same problem as me, but in that case there is access to the source code and he is able to build a plugin.

This blogpost shows how use feature patches, but they require that I'm able to build my own plugin, which I cant since I have just the one class.

Community
  • 1
  • 1
Fredrik
  • 10,626
  • 6
  • 45
  • 81

2 Answers2

7

I would not try using a fragment. In my experience, the cleanest thing to do would be to use a feature patch. I have successfully used feature patches to do exactly what you are looking to do. It's not simple, but it is robust. You need to do the following.

  1. create a plugin that encapsulates your single class file
  2. create a feature patch that includes your new plugin and that patches the feature that you are targeting.
  3. export your feature patch and create the p2 metadata (to create an update site).
  4. Install into your Eclipse using the install manager
  5. Rejoice!

  6. (optional) Feature patches by default only target a single version of the target feature. So, if the target feature bumps up its version number, the feature patch will silently no longer be applied. However, it is possible to relax the version constraints on the feature patch. This process is described in detail here: http://aniefer.blogspot.com/2009/06/patching-features-part-2.html

More information:

http://aniefer.blogspot.com/2009/06/patching-features-with-p2.html http://aniefer.blogspot.com/2009/06/patching-features-part-2.html

The benefit of using a feature patch over a fragment is that anyone can install the patch and get the patch working, but things are more difficult with a fragment in that end users must muck with manifests.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • Yes, feature patches seems to be the right option. My problem is that I have issues with dependencies in the file that prevent me from creating a plugin, unless I want to include most of the plugin. Doing so what put me back into my original problem of legal issues. What you are suggesting is the way to go if you can, so I'll mark this as the answer. – Fredrik Oct 10 '11 at 14:02
2

So this means I have a single class file that I want to be loaded instead of a class in a plugin, is this at all possible?

Your first sentence is the answer. You can use a fragment, but that requires modifying the manifest in the plugin. Otherwise, Eclipse would have no idea which class to load.

My suggestion is that you write IBM with all of this information, including the patch. IBM should be able to release a maintenance fix which would solve your problem.

In the mean time, you could pursue the fragment option, which would require you to unpack the jar, add your fragment, modify the manifest, and repackage the jar. Whether or not this is legal is beyond my ability to determine.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111
  • Yes, waiting for an offical bugfix seems to be the only fully safe and completly legal way to handle this. – Fredrik Oct 10 '11 at 13:58