A Java decompiler built on top of Emmanuel Dupuy's original version of jd-core based on bytecode pattern matching
import org.jd.core.v1.loader.ClassPathLoader; // uses v1 loader for compatibility
import jd.core.preferences.Preferences;
import jd.core.printer.PlainTextPrinter;
import jd.core.process.DecompilerImpl;
public class Sample {
private static final DecompilerImpl DECOMPILER = new DecompilerImpl();
public static void main(String[] args) {
try {
ClassPathLoader loader = new ClassPathLoader();
PlainTextPrinter printer = new PlainTextPrinter();
Preferences preferences = new Preferences();
preferences.setRealignmentLineNumber(true);
preferences.setShowDefaultConstructor(true);
preferences.setShowLineNumbers(true);
preferences.setShowPrefixThis(true);
preferences.setUnicodeEscape(false);
preferences.setWriteMetaData(true);
String out =
printer.buildDecompiledOutput(
loader,
"java/lang/String",
preferences,
DECOMPILER
);
System.out.println(out);
} catch (Exception e) {
System.err.println(e);
}
}
}CI runs the test suite on JDK 17, 21, and 25 with both javac and ECJ, targeting Java 17 bytecode. Source validation uses the API signatures for each fixture's requested Java release, independently of the JDK running the tests. Line numbers are always displayed when the option is on; the dedicated alignment tests check that numeric line comments match their physical output line where realignment is possible. To scan every class in the direct test dependency JARs and compare numbered lines with the matching source JARs, first fetch the test sources, then run:
mvn dependency:sources -DincludeScope=test
mvn -Dtest=DependencyJarLineNumberAuditTest -DlineAudit.dependencies=true testFor large JARs, use -DlineAudit.marker=net/sourceforge/plantuml/SourceStringReader.class with -DlineAudit.start=0 -DlineAudit.limit=1000, then advance lineAudit.start by 1000 for each batch. The audit reports classes that could not be decompiled separately from line number mismatches. Exact source text matches are reported as evidence; reconstructed Java can differ from the original text while keeping the correct line number.
To audit another local JAR and its adjacent -sources.jar, set -DlineAudit.jar=/path/to/library.jar; -DlineAudit.start and -DlineAudit.limit also work for this mode. The summary reports misaligned line numbers: source numbers that are displayed but could not be placed on the corresponding physical output line.