RFR: 8060130: Simplify the synchronization of defining and getting java.lang.Package

Mandy Chung mandy.chung at oracle.com
Wed Oct 22 21:56:59 UTC 2014

On 10/21/2014 2:08 PM, Bernd Eckenfels wrote:
> Hello,
> one thing I wonder - in the old and in the new case there is nothing
> in definePackage() guaring the parents from getting to know the new
> package and causing a conflict (as the atomic insert is only on the
> specific packages table. Are those (parent and system package)
> immutable?

Each class loader maintains its own package map.

I guess your question is related to my comment about two class loaders
can define classes in a package of the same name (two different runtime
packages).  ClassLoader.getPackage(s) assumes there is only one Package
for each name in the class loader chain which seems wrong to me. Claes
has filed a bug to track this:

[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-October/029146.html

More information about the core-libs-dev mailing list