Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
On 9/2/2016 4:17 PM, fo...@univ-mlv.fr wrote: - Mail original - De: "harold seigel" <harold.sei...@oracle.com> À: "Remi Forax" <fo...@univ-mlv.fr> Cc: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" <hotspot-runtime-...@openjdk.java.net>, core-libs-dev@openjdk.java.net Envoyé: Vendredi 2 Septembre 2016 20:32:55 Objet: Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class 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. yes, right. but i've always believed that the name was more for debugging purpose, i.e. because a VM anonymous class name is not registered in a Classloader, so the VM will never find an anonymous class by it's name. Having a package name that matches its host class's ensures that the anonymous class is in the same module as its host class in cases where the VM determines a class's module from its Klass's package entry structure. Harold 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. yes, true. We recognize that this, and many other things, will have to change once array classes have their own methods. Thanks, Harold Thanks for the explanation, Rémi 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.sei...@oracle.com> À: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" <hotspot-runtime-...@openjdk.java.net>, core-libs-dev@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
Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
- Mail original - > De: "harold seigel" <harold.sei...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" > <hotspot-runtime-...@openjdk.java.net>, > core-libs-dev@openjdk.java.net > Envoyé: Vendredi 2 Septembre 2016 20:32:55 > Objet: Re: RFR 8058575: IllegalAccessError trying to access package-private > class from VM anonymous class > 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. yes, right. but i've always believed that the name was more for debugging purpose, i.e. because a VM anonymous class name is not registered in a Classloader, so the VM will never find an anonymous class by it's name. > > 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. yes, true. > > We recognize that this, and many other things, will have to change once > array classes have their own methods. > > Thanks, Harold Thanks for the explanation, Rémi > > > 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.sei...@oracle.com> >>> À: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" >>> <hotspot-runtime-...@openjdk.java.net>, >>> core-libs-dev@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
Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
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.sei...@oracle.com> À: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" <hotspot-runtime-...@openjdk.java.net>, core-libs-dev@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
Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
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.sei...@oracle.com> > À: "Alan Bateman" <alan.bate...@oracle.com>, "Hotspot dev runtime" > <hotspot-runtime-...@openjdk.java.net>, > core-libs-dev@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
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
Re: RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
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
RFR 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
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/ http://cr.openjdk.java.net/~hseigel/bug_8058575.hs.3/ The fix was tested with the JCK API, Lang and VM tests, the hotpot, and java/lang, java/util and other JTreg tests, the RBT tier2 tests, and the NSK colocated tests and non-colocated quick tests. Thanks, Harold