Re-examine ClassLoader.getPackage(s) methods
Alan Bateman
Alan.Bateman at oracle.com
Sat Sep 26 14:33:40 UTC 2015
On 25/09/2015 23:38, Mandy Chung wrote:
> :
>
> I propose to minimize the compatibility risk and revert JDK 9 behavior
> of ClassLoader.getPackage(s) methods. Instead add two new methods:
> ClassLoader::getDefinedPackage(String) and getDefinedPackages() to
> return the defined packages by this class loader.
>
> I considered deprecating ClassLoader::getPackage(s). These methods
> are not doing anything inherently wrong or causing any risk although
> the spec and impl version, title, vendor, annotation might not be th
> expected value. The Package design and implementation has been flawed
> since 1.2. This patch leaves it with @apiNote to make it clear.
>
This looks good. I think I would lean more to deprecating getPackage as
just too fragile and leads to difficult to diagnose bugs.
BTW: I assume the proxy test is a separate change-set and not mean to be
in this patch.
-Alan
More information about the jigsaw-dev
mailing list