Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314482

Summary: RegisteredPolicy requires unnecessary "required"
Product: [Eclipse Project] Equinox Reporter: Frank Mising name <fmbsg-eclipse>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frank Mising name CLA 2010-05-26 11:04:29 EDT
Build Identifier: org.eclipse.osgi_3.5.2.R35x_v20100126.jar

Assume having three plugins: p.hibernate, p.hibernateHelper and p.mySQL. p.hibernateHelper "requires" p.hibernate, since it composes the Session and so on. It has an ExtensionPoint "Configuration" which collects e.g. the driver's class name from p.mySQL, which in turn plugs into that ExtensionPoint. Hence p.mySQL "requires" p.hibernateHelper. And finally (often described) p.hibernate allows buddies to "register". p.mySQL does so and registers to p.hibernate.

This leads to a ClassNotFoundException for com.mysql.jdbc.Driver. If you "require" p.hibernate within p.mySQL, the CNFDE disappears and everything works fine.

I've tracked that down to RegisteredPolicy:

	public Class loadClass(String name) {
		if (allDependents == null)
			return null;
		Class result = null;

The class loading process walks thru it's different steps and finally reaches the buddy loading. Correct! But why does it check for "allDependents"? That might be correct for policy "dependent". But if I "regsiter" myself explicitly, why do I need to "require" also? Seems strange. Shouldn't it be "allRegistrants" or something like that?

Even worse, I've "rexeported" p.hibernate within p.hibernateHelper. Since p.mySQL "requires" p.hibernate, which in turn "requires and reexports" p.hibernate, allDependents should not be empty, shouldn't it?

Maybe I've misunderstood the whole concept. But on the other hand, I cannot find an exhausting reference documentation / detailled users guide for the whole stuff.

Regards
Frank

Reproducible: Always
Comment 1 Thomas Watson CLA 2010-05-26 15:36:48 EDT
(In reply to comment #0)
> Even worse, I've "rexeported" p.hibernate within p.hibernateHelper. Since
> p.mySQL "requires" p.hibernate, which in turn "requires and reexports"
> p.hibernate, allDependents should not be empty, shouldn't it?

This is bug197887.

> 
> Maybe I've misunderstood the whole concept. But on the other hand, I cannot
> find an exhausting reference documentation / detailled users guide for the
> whole stuff.
> 
Best we got is 
http://wiki.eclipse.org/index.php/Context_Class_Loader_Enhancements

Where this behavior is described.

*** This bug has been marked as a duplicate of bug 198083 ***