I'm fine with the removal, although if you remember we use it in Nashorn too[0], and when I tried to replace it with the hidden classes facility the issue we run into was that hidden classes' methods didn't show up in stack traces the way anonymous classes' methods did[1]. Since Nashorn uses anonymous classes to install compiled JavaScript application code, it is important to be able to report stack traces from them. It unfortunately can't just use StackWalker, as it has to post-edit traces of already thrown exceptions.
So ensuring JDK-8212620 is implemented as well, and/or maybe having a MethodHandles.Lookup.ClassOption to specify the class should show up in stack traces would be important to implement alongside the removal. It's not a show-stopper, Nashorn will be able to gracefully fail over to ordinary class loading in absence of anonymous class loading, but I'd really like to be able to transition to using hidden classes if we could get them to show up in stack traces. Attila. [0] https://github.com/openjdk/nashorn/blob/main/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/runtime/Context.java#L329 [1] https://mail.openjdk.java.net/pipermail/nashorn-dev/2020-October/007578.html On Tue, May 11, 2021 at 1:03 AM Mandy Chung <mandy.ch...@oracle.com> wrote: > Thank you all. > > Mandy > > On 5/10/21 2:27 PM, Paul Sandoz wrote: > > Looks good, I took the liberty of making some minor edits, mostly fixing > some typos. > > > > Paul. > > > >> On May 10, 2021, at 12:26 PM, Mandy Chung <mandy.ch...@oracle.com> > wrote: > >> > >> Hidden classes were added in Java SE 15. Class data support was added > in 16. `sun.misc.Unsafe::defineAnonymousClass` was deprecated in JDK 15 and > deprecated for terminally removal in JDK 16. > >> > >> I propose to remove `sun.misc.Unsafe::defineAnonymousClass` from JDK 17: > >> CSR: https://bugs.openjdk.java.net/browse/JDK-8266760 > >> > >> Comments? > >> > >> Mandy > >