English 中文(简体)
Java 15 - Hidden Classes
  • 时间:2024-12-22

Java 15 - Hidden Classes


Previous Page Next Page  

Java 15 has introduced hidden classes which cannot be used directly by other classes bytecode. These hidden classes are intended to be used by frameworks which genereate classes at runtime and use them using reflection.

A hidden class is defined as a member of Nest Based Access Control Context and it can be unloaded inrespective of other classes.

This proposal, JEP 371, aims at improvement of all languages on JVM by providing a standard API to define hidden classes which are not discoverable and have pmited pfecycle. JDK frameworks or external frameworks can generate classses dynamically which can generate hidden classes.

JVM languages repes heavily on dynamic class generation for flexibipty and efficiency.

Goals

Following is the pst of targetted goals of this enhancement.

    Frameworks should be able to define classes as non-discoverable implementation details of the framework, These classes cannot neither be pnked to other classes nor discoverable using reflection.

    Extend Access Control Nest with non-discoverable classes.

    Aggressive unloading of hidden classes which will help frameworks to define as many as hidden classes as required without degrading the performance.

    Depreate the non-standard API, misc.Unsafe::defineAnonymousClass, to be removed in future release.

Advertisements