JEP 484: Class-File API
Last updated
Last updated
The new Class-File API (JEP 484) is now a fully supported feature of Java 24.
It provides a clean, safe, and standard way to inspect and manipulate .class
files — no more relying on external tools like ASM.
EP 484 introduces a standard API for parsing, generating, and transforming Java class files. This API resides in the java.lang.classfile
package and provides a structured way to interact with class file elements without relying on third-party libraries.
The API is built around three main abstractions:
Elements: Immutable descriptions of parts of a class file, such as instructions, attributes, fields, methods, or the entire class file.
Builders: Corresponding builders for compound elements that facilitate the creation or transformation of class file components.
Transforms: Functions that take an element and a builder to mediate how, if at all, that element is transformed into other elements.
example of sealed interface:
run :
Access Flags: 33
mean?The access flags are stored as a bitmask integer in the .class
file.
Java uses constants like:
ACC_PUBLIC
0x0001
1
ACC_SUPER
0x0020
32
33 = 1 (public) + 32 (super)
So:
✅ It means:
The class is public
The ACC_SUPER
bit is set — which is always set in modern .class
files and signals to the JVM to use special superclass method invocation rules