Hidden Classes in Java 15

Java has had anonymous classes from the very start. (Well, actually, they came in version 1.1.) However, anonymous classes were not anonymous. You did not need to name them, but under the hood, they were named by the Java compiler. If you are familiar with the command javap, you can "disassemble" a JAR file and see the name of the compiler generated for the anonymous classes.

Java 15 introduced hidden classes, which do not have a name. Almost, as you will see. It is not part of the language but part of the JDK. There is no language element to create hidden classes, but JDK methods and classes come to the rescue.

CategoriesUncategorized