Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314482 - RegisteredPolicy requires unnecessary "required"
Summary: RegisteredPolicy requires unnecessary "required"
Status: CLOSED DUPLICATE of bug 198083
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 11:04 EDT by Frank Mising name CLA
Modified: 2010-05-26 15:36 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 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 ***