https://github.com/assert-kth/decompilercmp

Dataset and tool to analyse and compare java bytecode decompilers

https://github.com/assert-kth/decompilercmp

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

decompiler java kth open-science
Last synced: 5 months ago · JSON representation

Repository

Dataset and tool to analyse and compare java bytecode decompilers

Basic Info
Statistics
  • Stars: 19
  • Watchers: 4
  • Forks: 4
  • Open Issues: 1
  • Releases: 0
Topics
decompiler java kth open-science
Created over 6 years ago · Last pushed over 5 years ago
Metadata Files
Readme

README.md

Decompiler Comparator

The aim of this project is compare java decompilers, see The Strengths and Behavioral Quirks of Java Bytecode Decompilers (doi:10.1109/scam.2019.00019).

```bibtex % conference paper @inproceedings{scam2019, title = {The Strengths and Behavioral Quirks of Java Bytecode Decompilers}, booktitle = {Proceedings of the 19th IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM )}, year = {2019}, author = {Nicolas Harrand and César Soto-Valero and Martin Monperrus and Benoit Baudry}, doi = {10.1109/scam.2019.00019}, url = {http://arxiv.org/pdf/1908.06895}, }

% journal paper @article{jss2020, title = {Java Decompiler Diversity and its Application to Meta-decompilation}, journal = {Journal of Systems and Software}, year = {2020}, doi = {10.1016/j.jss.2020.110645}, author = {Nicolas Harrand and César Soto-Valero and Martin Monperrus and Benoit Baudry}, url = {http://arxiv.org/pdf/2005.11315}, }

```

Usage

```bash

Run decomiler -> Ast diff -> compiler -> test on each class

java -cp decompilercmp.jar se.kth.DecompilerComparator -p /path/to/test/project -d DecompilerName

Run decomiler -> Ast diff -> compiler -> test on a single class

java -cp decompilercmp.jar se.kth.DecompilerComparator -p /path/to/test/project -d DecompilerName -c org/mypackage/MyClass ```

Output (projectName-decompiler-report.csv):

csv Class,isDecompilable,distanceToOriginal,isRecompilable,passTests

  • Class: Class name
  • isDecompilable: has the decompiler sucessuflly produced a java file for the given class?
  • distanceToOriginal: Number of edit operation needed on the original AST to obtain the decompiled AST. (Integer.MIN_VALUE if the evaluation failed)
  • nbNodesOriginal: Number of AST node in the original java source file.
  • isRecompilable: can the decompiled java code be recompiled?
  • bytecodeDistance: Minimum number of atomic edit to go from the original bytecode to the decompiled/recompiled one. (Computed with jardiff)
  • passTests: do the tests of the project still pass after decompilation/recompilation of the class.

AST comparator is shamelessly copied from gumtree-spoon-ast-diff.

Note that if the targeted project supports it, eclipse compiler can be used instead of javac with

bash java -cp decompilercmp.jar se.kth.DecompilerComparator -p /path/to/test/project -d DecompilerName -j eclipse

Optional: run yajta in Tie mode to collect information on which tests to run for each class. (Put the tie-report.json in the root of the targeted project).

Complete command line help

``` Usage:

[options] Options: --debug-class, -c Optional. Run a single class --decompiler-name, -d Name of the decompiler to test. See se.kth.Decompiler for more details. Default CFR-0.141 Default: CFR-0.141 --help, -h Display this message. Default: false --java-compiler, -j Path to output directory. Default: default Default: javac --output-dir, -o Path to output directory. Default: report Default: report --project, -p Directory containing test reports --with-tests, -t Meta decompile with tests Default: false

Available decompilers: Dava-3.3.0 Procyon-0.5.34 JADX-0.9.0 Jode-1.1.2-pre1 Fernflower CFR-0.141 Krakatau JD-GUI-1.4.1 Arlecchino

```

Run test on Meta-Decompiler

Flag -t can be used to stop only when a decompilation that passes tests is found.

bash java -cp decompilercmp.jar se.kth.DecompilerComparator -p /path/to/test/project -d Meta -j eclipse [-t]

Owner

  • Name: ASSERT
  • Login: ASSERT-KTH
  • Kind: organization
  • Location: Sweden

assertEquals("Research group at KTH Royal Institute of Technology, Stockholm, Sweden", description);

GitHub Events

Total
Last Year

Dependencies

pom.xml maven
  • ca.mcgill.sable:soot 3.3.0
  • com.beust:jcommander 1.27
  • com.github.gumtreediff:core 2.1.2
  • com.google.code.gson:gson 2.8.5
  • commons-io:commons-io 2.6
  • fr.inria.gforge.spoon:spoon-core 7.5.0
  • fr.inria.gforge.spoon:spoon-core 7.3.0
  • log4j:log4j 1.2.15
  • net.sf.trove4j:trove4j 3.0.3
  • org.apache.maven.shared:maven-invoker 3.0.1
  • org.benf:cfr 0.141
  • org.bitbucket.mstrobel:procyon-compilertools 0.5.34
  • org.jboss.windup.decompiler.fernflower:fernflower 2.5.0.Final
  • org.json:json 20090211
  • org.ow2.asm:asm 7.2
  • cli.jd:jd-gui 1.4.1 system
  • jadx:jadx-cli 0.9.0 system
  • jd:jd-core 1.0.0 system
  • org.jode:jode-decompiler 1.2.1-pre1 system
  • scala:jardiff 1.2.0 system
  • commons-cli:commons-cli 1.2 test
  • junit:junit 4.11 test
repo-resources/Bukkit/pom.xml maven
  • com.google.guava:guava 10.0.1 compile
  • com.googlecode.json-simple:json-simple 1.1 compile
  • org.avaje:ebean 2.7.3 compile
  • org.yaml:snakeyaml 1.9 compile
  • commons-lang:commons-lang 2.3
  • junit:junit 4.11 test
  • org.hamcrest:hamcrest-library 1.3 test
repo-resources/DiskLruCache/pom.xml maven
  • commons-io:commons-io 2.1 test
  • junit:junit 4.10 test
  • org.easytesting:fest-assert-core 2.0M10 test
repo-resources/commons-codec/pom.xml maven
  • junit:junit 4.11 test
repo-resources/commons-collections/pom.xml maven
  • junit:junit 4.11 test
  • org.easymock:easymock 3.2 test
repo-resources/commons-imaging/pom.xml maven
  • commons-io:commons-io 2.4 test
  • junit:junit 4.11 test
repo-resources/commons-lang/pom.xml maven
  • org.easymock:easymock 4.0.2 test
  • org.hamcrest:hamcrest 2.1 test
  • org.junit-pioneer:junit-pioneer 0.3.0 test
  • org.junit.jupiter:junit-jupiter 5.4.0 test
  • org.openjdk.jmh:jmh-core 1.21 test
  • org.openjdk.jmh:jmh-generator-annprocess 1.21 test
repo-resources/javapoet/pom.xml maven
  • junit:junit 4.10 test
  • org.easytesting:fest-assert-core 2.0M8 test
repo-resources/joda-time/pom.xml maven
  • org.joda:joda-convert 1.2 compile
  • junit:junit 3.8.2 test
repo-resources/jsoup/pom.xml maven
  • junit:junit 4.5 test
repo-resources/junit4/pom.xml maven
  • org.hamcrest:hamcrest-core 1.3
repo-resources/mimecraft/pom.xml maven
  • junit:junit 4.10 test
  • org.easytesting:fest-assert-core 2.0M10 test
repo-resources/scribejava/pom.xml maven
  • commons-codec:commons-codec 1.4 compile
  • junit:junit 4.8.1 test
repo-resources/spark/pom.xml maven
  • org.slf4j:slf4j-simple 1.7.2 provided
  • org.eclipse.jetty:jetty-server 9.0.2.v20130417
  • org.eclipse.jetty:jetty-webapp 9.0.2.v20130417
  • org.slf4j:slf4j-api 1.7.2
  • com.google.code.gson:gson 2.2.4 test
  • junit:junit 4.8.1 test
  • org.apache.httpcomponents:httpclient 4.2.2 test
  • org.freemarker:freemarker 2.3.19 test
repos/dctest/pom.xml maven
  • junit:junit 4.11 test