RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class

harold seigel harold.seigel at oracle.com
Fri Sep 2 18:32:55 UTC 2016

Hi Rémi,

Thank you for looking at this change.

Not allowing host classes to be array classes is not completely 
unrelated to this bug because it affects the implementation of the code 
that prepends the host class's package to the anonymous class.

We decided to not allow array host classes in JDK-9 because it makes no 
sense.  A user who does this is likely doing so in error, and should be 
flagged for it.

We recognize that this, and many other things, will have to change once 
array classes have their own methods.

Thanks, Harold

On 9/2/2016 11:25 AM, Remi Forax wrote:
> Harold,
> disallowing array classes as host classes seems unrelated and knowing that jdk 10 or 11 will certainly add default methods to arrays,
> we will want to have anonymous classes with arrays as host class in order to acts as bridges/mixins.
> regards,
> Rémi
> ----- Mail original -----
>> De: "harold seigel" <harold.seigel at oracle.com>
>> À: "Alan Bateman" <Alan.Bateman at oracle.com>, "Hotspot dev runtime" <hotspot-runtime-dev at openjdk.java.net>,
>> core-libs-dev at openjdk.java.net
>> Envoyé: Vendredi 2 Septembre 2016 17:03:34
>> Objet: Re: RFR 8058575: IllegalAccessError trying to access package-private	class from VM anonymous class
>> Thanks Alan.  I'll go ahead and make that change.
>> Harold
>> On 9/2/2016 10:43 AM, Alan Bateman wrote:
>>> On 02/09/2016 14:02, harold seigel wrote:
>>>> Hi,
>>>> Please review this new fix for JDK-8058575.  This fix requires that a
>>>> VM anonymous class be in either the same package as its host class or
>>>> be in the unnamed package.  If the anonymous class is in the unnamed
>>>> package then this fix puts it into its host class's package, ensuring
>>>> that the anonymous class and its host class are in the same module.
>>>> This fix also throws an IllegalArgumentException if the host class is
>>>> an array class.
>>>> Additionally, the type of field ClassFileParser::_host_klass was
>>>> changed to InstanceKlass* and some comments were cleaned up.
>>>> JBS bug: https://bugs.openjdk.java.net/browse/JDK-8058575
>>>> Open webrevs:
>>>>     http://cr.openjdk.java.net/~hseigel/bug_8058575.jdk.3/
>>> In GetModuleTest then one clean-up is to change it to use
>>> hostClass.getPackageName() and remove packageName(String).
>>> -Alan

More information about the core-libs-dev mailing list