Bug 118020 - System (thread context) class loader should refuse to load classes of ambiguous origin
System (thread context) class loader should refuse to load classes of ambiguo...
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Module System
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Jesse Glick
issues@platform
http://wiki.netbeans.org/wiki/view/De...
:
: 22508 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-06 23:26 UTC by Jesse Glick
Modified: 2008-12-23 14:22 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-10-06 23:26:07 UTC
In the interests of failing early and predictably with a helpful diagnostic message, rather than behaving erratically,
the NB "system" class loader (the default thread context class loader), which is capable of loading classes (and
resources) from all modules, should simply refuse to load a class (or resource) when there would be more than one choice
of module (parent class loader) to load it from. This would save people from cryptic class linkage errors etc. in cases
where a library is present (possibly in different versions) in multiple modules, and some code is calling Thread.gCCL to
load something from this library. Background information is given in wiki (see URL), which would be a good detail
message for the exception. (ClassNotFoundException?)
Comment 1 Jesse Glick 2007-10-16 01:31:50 UTC
Probably too risky to change this behavior in 6.0.
Comment 2 Antonin Nebuzelsky 2008-05-13 15:39:08 UTC
To be evaluated for 6.5.
Comment 3 Jesse Glick 2008-05-14 02:15:22 UTC
Implemented in #a0c528f7976a.
Comment 4 Quality Engineering 2008-05-20 05:21:42 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #206 build
Changeset: http://hg.netbeans.org/main/rev/a0c528f7976a
User: Jesse Glick <jglick@netbeans.org>
Log: #118020: forbid ambiguous delegation to parent class loaders.
Comment 5 Petr Nejedly 2008-05-20 07:33:50 UTC
You implemented it for all class loaders, not only for the system one, right?
So maybe you'd better guard the additional attempts with an assert to not slow down class loading, though the startup
cache might downplay the impact (for a slight size growth).
Keep in mind that parts of openide are loaded this way...
Comment 6 Jesse Glick 2008-05-20 17:42:30 UTC
There are only a few packages which in fact overlap. Anyway the error is believed not to be thrown in the standard NB
IDE so the main purpose is to assist diagnosis for people using third-party modules, which are most likely to be running
atop an IDE release in which assertions are disabled.
Comment 7 Jesse Glick 2008-06-11 03:02:11 UTC
*** Issue 22508 has been marked as a duplicate of this issue. ***
Comment 8 Quality Engineering 2008-12-23 14:22:37 UTC
This issue had *4 votes* before move to platform component


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo