Giter Club home page Giter Club logo

jdk-classfile-preview's Introduction

Unofficial JDK Classfile API Backport

Maven Central

This is a backport to JDK 17 of the new classfile API found in JDK 21 and later.

Bugs in this project should be reported to https://github.com/dmlloyd/jdk-classfile-preview/issues first. Bugs in this project are likely to be a result of backporting. Some bugs might be relayed upstream by the project maintainer(s), subject to testing and verification; in this case, the upstream bug will be linked for easier tracking.

Releases

Releases of the project roughly track releases of the corresponding JDK from which it is backported. This means that version 23.x of this project corresponds to the state of the upstream classfile API in JDK 23, and so on.

The upstream classfile API is expected to leave preview for Java 24. At that time, it is expected that binary compatibility will be maintained with a strictness corresponding to that of the upstream API. Until then, there can (and will) be various API breakages which occur between major versions. Keep this in mind when planning integration into new projects.

It is currently planned to continue to backport features from Java versions beyond 24. The major version of this project will continue to correspond to the JDK from which the changes were backported. When planning a transition from this library to the official API, be sure that the major version of this library corresponds to the target JDK to avoid a situation where you start using features which are not available in the JDK version you want to target, causing difficulties when migrating.

The release schedule is fairly ad-hoc and irregular. If you encounter a bug which has been fixed in this project but not yet released, feel free to open an issue to request a release.

Getting started

After adding the appropriate Maven dependency (see the Maven release badge above), the easiest entry points are:

For parsing a class:

byte[] b = Files.readAllBytes(Path.of("some/file.class"));
ClassModel model = ClassFile.of().parse(b);
// now, do something with `model`...

Or for writing a class:

byte[] b = ClassFile.of().build(classDesc, classBuilder -> {
    // ... build the class here ...
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.