Bug 378855 - fix class loading issues with RepositoryClientManager
Summary: fix class loading issues with RepositoryClientManager
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.8   Edit
Assignee: Benjamin Muskalla CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2012-05-08 11:02 EDT by Benjamin Muskalla CLA
Modified: 2012-06-03 14:27 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2012-05-08 11:02:58 EDT
RepositoryClientManager currenlty has problem accessing the configuration classes during deserialization. We should make it aware of the right classloader to make this work.
Comment 1 Benjamin Muskalla CLA 2012-05-08 11:06:40 EDT
Pushed a fix to http://review.mylyn.org/#change,511

Steffen, I don't see a chance to get hold of the classloader for the configuration based on the type parameter. Under regular circumstances, I don't see a reason why the config ctor should have any side effects (see TODO). Any thoughts?
Comment 2 Steffen Pingel CLA 2012-05-08 11:17:08 EDT
Thanks for the patch. I don't think we should create objects to obtain a class loader reference. In the worst case scenario it might not be the right class loader if the class lives in a different bundle. I would prefer if we injected the class loader in the constructor of RepositoryClientManager to make it obvious how the class works.
Comment 3 Steffen Pingel CLA 2012-05-08 16:55:22 EDT
We could also consider passing the configuration class object. That way we could provide a default implementation for createRepositoryConfiguration and access the classloader.
Comment 4 Benjamin Muskalla CLA 2012-05-08 17:56:28 EDT
I'd try to avoid leaving classloading up to consumers. I think we should not expose the classloader in the API. I uploaded a new patch set which actually gets the right classloader from the configuration type param to load it.
Comment 5 Steffen Pingel CLA 2012-05-14 07:07:05 EDT
While I agree that API should be kept as simple as possible the class loading complications are an inherent property of the implementation and consumers should be aware of that. Since the class is SPI, consumers are implementors of OSGi bundles and it seems reasonable to me to require a Class instance to obtain the corresponding class loader. I have pushed a change to Gerrit that modifies your implementation slightly:

 https://git.eclipse.org/r/5970
 https://git.eclipse.org/r/5971

The other consideration is maintainability of the code. I appreciate the smart use of reflective APIs but I'm worried that understanding and changing this type code is significantly more challenging and error prone than a more common solution that obtains a class loader from a class.
Comment 6 Benjamin Muskalla CLA 2012-05-21 07:07:54 EDT
Steffen, I think we can close this as being fixed. The only item left for our consumers would be to push this into an API package. Or should we wait another release to see if there are any API changes left.
Comment 7 Steffen Pingel CLA 2012-05-23 13:03:38 EDT
I moved the class into API: https://git.eclipse.org/r/#change,6094. Thanks for your efforts, Benjamin.
Comment 8 Benjamin Muskalla CLA 2012-05-24 05:07:42 EDT
Hm, @org.eclipse.mylyn.internal.tasks.core@ doesn't sound like API to me ;)
Comment 9 Steffen Pingel CLA 2012-06-03 10:05:11 EDT
I would have to agree with that :).
Comment 10 Steffen Pingel CLA 2012-06-03 14:27:06 EDT
Moved to API package in ba998485fdb6e76b3983890e0fa17538aa36728d.