A modern Java classfile manipulation and analysis library
This is a modern Java classfile manipulation and analysis library. This library is a modern replacement for ASM, extracted from the latest internal implementation of JDK, requires Java 17 as a minimum version.
Please replace ${version}
with the current version of this library.
Maven:
<dependency>
<groupId>org.glavo</groupId>
<artifactId>classfile</artifactId>
<version>${version}</version>
</dependency>
Gradle:
implementation("org.glavo:classfile:${version}")
The core class of the Classfile API is Classfile
.
A tutorial is in the works, now you can look at the examples, or check out the JEP draft for help.
This library is extracted from OpenJDK 21
and renamed package jdk.internal.classfile
to org.glavo.classfile
.
In order to be compatible with Java 17, this library also copies some new APIs in Java 20:
java.lang.reflect.AccessFlag
-> org.glavo.classfile.AccessFlag
java.lang.reflect.ClassFileFormatVersion
-> org.glavo.classfile.ClassFileFormatVersion
Because the implementation in JDK is still in the jdk.internal.classfile
package and does not belong to the public API, the API of this library is still unstable
until the stable version of JEP Draft 8280389 is released.
Here is the change log.
If you encounter problems when using this library, please feed back through issue.
If you want to discuss the design of the Classfile API, please go to the Classfile API mailing list ([email protected]) for discussion.