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

Coleen Phillimore coleen.phillimore at oracle.com
Fri Sep 2 19:22:41 UTC 2016


http://cr.openjdk.java.net/~hseigel/bug_8058575.hs.3/src/share/vm/classfile/classFileParser.cpp.udiff.html

Can you call new_symbol instead?  SymbolTable::lookup() should have been 
an internal API.

*+ _class_name = SymbolTable::lookup(new_anon_name,*

A bit nerve wracking not having a trailing NULL character but it looks 
correct.

http://cr.openjdk.java.net/~hseigel/bug_8058575.hs.3/test/runtime/defineAnonClass/TestBadHostClass.java.html

Should this test be put in the JDK tests, since it's testing the new 
restrictions on Unsafe anonymous classes?

The tests look great though.

Thank you for doing the InstanceKlass cleanup.  Also, to answer Remi's 
question, if arrays are changed to have methods, including default 
methods, we'd have to change the metadata types for Klass to represent 
that and would have to change the code so that access through the 
host_klass has meaning.  This code is clean for the JDK9 meaning of 
host_klass.

Thanks,
Coleen


On 9/2/16 9:02 AM, 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/
>
>    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



More information about the hotspot-runtime-dev mailing list