JEP 484: Class-File API
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.
Key Components of the Class-File API
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.openjdk.org
Builders: Corresponding builders for compound elements that facilitate the creation or transformation of class file components.openjdk.org
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:
public sealed interface ClassModel
extends CompoundElement<ClassElement>, AttributedElement
permits ClassImpl {run :
ClassFileParser
result:
Class Name: com/wlodar/jeeps/jep484classfileapi/SampleForClassApi
Super Class: java/lang/Object
Access Flags: AccessFlags[flags=33]
Methods:
- <init>()V
- hello(Ljava/lang/String;)V🔍 What does Access Flags: 33 mean?
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)
33 = 1 (public) + 32 (super)So:
cssCopyEditAccessFlags[flags=33] → [PUBLIC, SUPER]✅ It means:
The class is public
The
ACC_SUPERbit is set — which is always set in modern.classfiles and signals to the JVM to use special superclass method invocation rules
Last updated