Transformer API

June 4, 2026 ยท View on GitHub

Dependabot updates Maven Central CodeQL Maven Release Github Release Coverage Status

The Transformer API provides convenient access to different transformers (currently decompilers only) under a unified API. The API is still subject to major changes, but only with a major version bump.

Installation

Maven

<dependency>
  <groupId>io.github.nbauma109</groupId>
  <artifactId>transformer-api</artifactId>
  <version>4.2.6</version>
</dependency>

Gradle

implementation 'io.github.nbauma109:transformer-api:4.2.6'

Gradle Kotlin DSL

implementation("io.github.nbauma109:transformer-api:4.2.6")

Usage

Currently, this API supports the following decompilers :

  • Fernflower
  • Vineflower (fork of Fernflower)
  • Procyon
  • CFR
  • JD-Core V0 and V1
  • JADX

Decompilers can be accessed either via StandardTransformers.Decompilers.ENGINE_* constants.

An example program decompiling a file using Vineflower (fork of Fernflower) is shown below:

package demo;

import com.heliosdecompiler.transformerapi.StandardTransformers;
import com.heliosdecompiler.transformerapi.common.Loader;

import jd.core.DecompilationResult;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;

public class Sample {

    public byte[] load(String internalName) throws IOException {
        InputStream is = this.getClass().getResourceAsStream("/" + internalName + ".class");
        return is == null ? null : IOUtils.toByteArray(is);
    }

    public boolean canLoad(String internalName) {
        return this.getClass().getResource("/" + internalName + ".class") != null;
    }

    
    public static void main(String[] args) {
        Sample sample = new Sample();
        Loader loader = new Loader(sample::canLoad, sample::load);
        Map<String, String> preferences = new HashMap<>();
        try {
            String ff = StandardTransformers.Decompilers.ENGINE_VINEFLOWER;
            DecompilationResult result =
                    StandardTransformers.decompile(
                            loader,
                            "java/lang/String",
                            preferences,
                            ff
                    );
            System.out.println(result.getDecompiledOutput());
        } catch (Exception e) {
            System.err.println(e);
        }
    }
}

Features

  • Agnostic loader utility
  • In-memory decompilation (no temp files)

Updates

This API will be updated as decompilers receive updates, which means fixes reach you faster.

Software using transformer-api

JD-GUI DUO - Desktop GUI

image

ECD++ - Eclipse plugin

image

Third-party

By AgeloVito :

Provides a comprehensive multi-decompiler toolkit and MCP server for Java, enabling deep analysis of bytecode and source code.

A multi-decompiler MCP server and CLI toolkit for Java, supporting JD-Core v0 & v1, CFR, Procyon, Fernflower, Vineflower & JADX.