The javadoc and specdiff have been updated in place to reflect the
recent discussion [1][2] to change the default of hidden classes that a
hidden class may be unloaded even when the defining loader is reachable
unless `ClassOption::STRONG` is specified such that the hidden class has
the same strong relationship with its defining loader as the normal
class has with its own defining loader.
javadoc/specdiff:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/api/
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/specdiff/
JVMS 5.4.4 change:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/Draft-JVMS-HiddenClasses.pdf
Thanks
Mandy
[1]
https://mail.openjdk.java.net/pipermail/valhalla-dev/2020-March/006889.html
[2]
https://mail.openjdk.java.net/pipermail/valhalla-dev/2020-March/006911.html
On 3/9/20 2:00 PM, Mandy Chung wrote:
Please review the CSR proposed for JEP 371 Hidden Classes [1].
CSR:
https://bugs.openjdk.java.net/browse/JDK-8238359
javadoc/specdiff:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/api/
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/specdiff/
JVMS 5.4.4 change:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/hidden-classes/Draft-JVMS-HiddenClasses.pdf
A brief summary of the changes:
1. A new Lookup::defineHiddenClass method is the API to create a
hidden class.
2. A new Lookup.ClassOption enum class defines NESTMATE and WEAK
option that
can be specified when creating a hidden class.
3. A new Class::isHiddenClass method tests if a class is a hidden class.
4. Field::setXXX method will throw IAE on a final field of a hidden class
regardless of the value of the accessible flag.
5. Class::getNestMembers is updated not to throw any exception when it
fails
to validate the nest membership. Instead this method will return all
members that are listed in `NestMembers` attribute if present and
determined to have the same nest host as this class.
We uncovered a bug in Lookup::defineClass spec throws LinkageError and
intends
to have the newly created class linked. However, the implementation
in 14
does not link the class. A separate CSR proposes to update the
implementation
to match the spec - please also review:
https://bugs.openjdk.java.net/browse/JDK-8240338
This is tracked as a separate JBS issue JDK-8238195 that is fixed in
this patch.
The code review will be posted separately.
Thanks
Mandy
[1] https://openjdk.java.net/jeps/371
[2] JDK-8230502 Add support in JVM TI and JDI for hidden classes
[3] JDK-8219607 Add support in Graal and AOT for hidden and weak class
[4]
https://mail.openjdk.java.net/pipermail/valhalla-dev/2020-March/006872.html