Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
05693c0
Bumped deps and fixed major checklint/spotbugs issues
judovana Sep 26, 2025
4301310
Added jdk 21 to test matrix
judovana Sep 26, 2025
61cd02b
Walk through the spotbugs, todo images
judovana Sep 26, 2025
78a9471
adapting plugins to new dependence
judovana Sep 28, 2025
1bcc62a
Trmporary moved to self build cplc. waiting for release
judovana Sep 29, 2025
eccd434
Moved to cplc 2.4
judovana Oct 14, 2025
f52e424
Fixed distro to temurin
judovana Oct 14, 2025
cafe18a
Fixed url to procyon
judovana Oct 14, 2025
48457e2
Bumping gradle
judovana Oct 14, 2025
29b35e6
Started work on building deps on my own
judovana Oct 14, 2025
58b052d
Added self build of jd
judovana Oct 15, 2025
0485adb
Indendted prrocyon
judovana Oct 15, 2025
0ad927f
Added jasm 9
judovana Oct 15, 2025
0719a4f
Removed jdk 11 and 17 from matrix, added jdk25
judovana Oct 15, 2025
53f5a4f
Remote spotbugs
judovana Oct 15, 2025
dfe7beb
jupiter is less tollerant to top level dirs
judovana Oct 15, 2025
2fe86f7
Remoed windows GH actions due to builds of dendencies
judovana Oct 15, 2025
43d2c47
Bumped to jupiter 6
judovana Oct 16, 2025
8c1f633
Running all tests
judovana Oct 16, 2025
cfa56b7
Re-enabling all test during install
judovana Oct 16, 2025
bdd7206
Build procyon with -g
judovana Oct 16, 2025
5bc16d0
Remoed unused depndence
judovana Oct 17, 2025
c75397d
Included plugins-build.sh to readme
judovana Oct 17, 2025
355a14b
Added few more readme hints about issues during builds
judovana Oct 17, 2025
56be522
Aligned jrd versions over propery
judovana Oct 17, 2025
564417f
More strict check on plugins
judovana Oct 17, 2025
2daee43
Aligned jscommander to common version
judovana Oct 17, 2025
3fc53a8
Again removed spotugs on static fields assignment from insrtance
judovana Oct 17, 2025
0ddbc16
Retrned spotugs on static fields assignment from insrtance - failing GHA
judovana Oct 17, 2025
2d68f14
Experimental iamges creation
judovana Oct 17, 2025
5c90e19
Fixing the write to static field from instance method findbugs warning
judovana Oct 17, 2025
6d3fd5e
Update README.md
judovana Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 32 additions & 36 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java-version: [ 11, 17 ]
os: [ubuntu-latest]
java-version: [ 21, 25 ]
fail-fast: false

name: ${{ matrix.os }} - Java ${{ matrix.java-version }} - Maven
Expand All @@ -28,58 +28,54 @@ jobs:
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
cache: maven
distribution: 'temurin'

- name: java version
run: java -version

- name: clone and build procyon devel we depeond on Linux
if: matrix.os == 'ubuntu-latest'
run: |
set -x
git clone https://github.com/mstrobel/procyon.git
cd procyon
git checkout develop
sed "s/6.9/7.3/g" -i gradle/wrapper/gradle-wrapper.properties
sed "s/.*<tt>.*//g" -i Procyon.Reflection/src/main/java/com/strobel/reflection/emit/CodeStream.java
./gradlew install
set -ex
git checkout runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java
mvn -batch-mode dependency:resolve || echo "this is expected to fail, hoefully all necessary parts for plugins build were downloaded"
bash runtime-decompiler/plugins-build.sh
shell: bash

- name: clone and build procyon devel we depeond on Windows
if: matrix.os == 'windows-latest'
run: |
@echo on
git clone https://github.com/mstrobel/procyon.git
cd procyon
git checkout develop
./gradlew.bat install
shell: cmd

- name: Build JRD with Maven
run: mvn --batch-mode --update-snapshots clean install
run: |
set -ex
git checkout runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java
mvn --batch-mode --update-snapshots clean install

- name: Create and populate config file on Linux
if: matrix.os == 'ubuntu-latest'
run: |
set -x
set -ex
CONFIG_HOME="$HOME/.config/java-runtime-decompiler/conf"
mkdir -p -v "$CONFIG_HOME"
AGENT_PATH=$(find "${{ github.workspace }}" -name "decompiler-agent-*.jar" | head -n 1)
echo "{\"AGENT_PATH\":\"${AGENT_PATH}\"}" > "$CONFIG_HOME/config.json"
cat "$CONFIG_HOME/config.json"
shell: bash

- name: Create and populate config file on Windows
if: matrix.os == 'windows-latest'
- name: Test Cli
timeout-minutes: 10
run: |
@echo on
setLocal EnableDelayedExpansion
set "CONFIG_HOME=%UserProfile%\.config\java-runtime-decompiler\conf"
md %CONFIG_HOME%
for /f "delims=" %%i in ('dir *decompiler-agent-*.jar /B /S') do set "AGENT_PATH=%%i"
set "AGENT_PATH=%AGENT_PATH:\=/%"
echo {"AGENT_PATH":"%AGENT_PATH%"} >"%CONFIG_HOME%\config.json"
type "%CONFIG_HOME%\config.json"
shell: cmd
set -e
cd runtime-decompiler
for x in `find -type f | grep src/test/java | sed "s;.*/;;"` ; do
git checkout ../runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java ;
echo started $x
mvn --batch-mode test -Dtest="**/*$x" -DfailIfNoTests=false "-Dsurefire.reportFormat=plain"
echo finished $x ;
done
git checkout ../runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java # this was broken by previous mvn run
mvn --batch-mode test -Dtest=*CliTest -DfailIfNoTests=false "-Dsurefire.reportFormat=plain" # run the most important one more times to keep report

- name: Test Cli
- name: try image
timeout-minutes: 10
run: mvn --batch-mode test -Dtest=*CliTest -DfailIfNoTests=false "-Dsurefire.reportFormat=plain"
run: |
set -e
git checkout runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java && mvn clean install -DskipTests -Pimages -Plegacy

2 changes: 1 addition & 1 deletion .plugin_config/codestyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
<property name="max" value="45"/>
</module>
<module name="ExecutableStatementCount">
<property name="max" value="40"/>
<property name="max" value="41"/>
<property name="tokens" value="METHOD_DEF,INSTANCE_INIT,STATIC_INIT,COMPACT_CTOR_DEF,LAMBDA "/>
</module>
<module name="LambdaBodyLength">
Expand Down
5 changes: 5 additions & 0 deletions .plugin_config/spotbugs_exclude.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- This usage of static field is intentional, and most importantly, it passes in -Plegacy (jdk8 bytecode), but fails in newer -->
<Match>
<Method name="~.*SetLast.*" />
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>
<!-- May expose internal representation by returning reference to mutable object -->
<!-- Swing components -->
<Match>
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ Internal *javap* and *javap -v* decompiling tools are available by default. In i
Additionally, external decompilers are supported and can be configured in *Configure → Plugins*:
* You can download them using the links below and set them up yourself using the *New* button.
* You can use `mvn clean install -PdownloadPlugins` from a terminal in the project's directory and import the necessary files using the *Import* button.
* You can use `sh runtime-decompiler/plugins-build.sh` to build plugins whic are not in maven repos, or are outdated in them
* thee is small chicken-egg problem, so you may need to call it few times in loops
* consult `-PdownloadPlugins`, `plugins-build.sh` and `.github/workflows/maven.yaml`

Currently supported decompilers are:
* [Fernflower](https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine)
* [Procyon](https://bitbucket.org/mstrobel/procyon/downloads/)
* [Procyon](https://github.com/mstrobel/procyon)
* [CFR](https://github.com/leibnitz27/cfr/)
* [JD](https://github.com/java-decompiler/jd-core/)

Expand All @@ -36,7 +39,7 @@ Assemblers/Disassemblers
* [jasm7](https://github.com/openjdk/asmtools) (jdk 11 and down, with known, broken lambdas)
* [jcoder7](https://github.com/openjdk/asmtools) (jdk 11 and down)
* [javap](https://github.com/openjdk/jdk) (disassemble only)
* [Procyon disassembler](https://bitbucket.org/mstrobel/procyon/downloads/)(disassemble only)
* [Procyon disassembler](https://github.com/mstrobel/procyon)(disassemble only)

Assemblers/Disassemblers with additional info
* [jasmG](https://github.com/openjdk/asmtools) (jdk 17 and up, with lambdas fixed, with -g switch)
Expand Down Expand Up @@ -138,11 +141,15 @@ $ git clone https://github.com/pmikova/java-runtime-decompiler.git
$ cd java-runtime-decompiler
$ mvn clean install # builds the runtime decpompiler and agent, downloads also plugins
$ mvn clean install -PdownloadPlugins # builds the decompiler and downloads the decompiler plugins for future use, if not already downloaded
$ sh runtime-decompiler/plugins-build.sh` # to build plugins whic are not in maven repos, or are outdated in them
$ mvn clean install -Pimages # on Linux, bundles the plugins and JRD into a standalone portable image. Make some basic verifications
$ mvn clean install -Plegacy # take care to build agent in oldest resonable way

# $PLUGINS and $VERIFY_CP variables may help to solve some weird image building issues.
```

Note, that `plugins-build.sh` and`-PdownloadPlugins` are lsightly looped together and you may need to run them both in cycles. Conslut `.github/workflows/maven.yaml` for details

usually the development command is:
```
$ mvn clean install -Dcheckstyle.skip -Dspotbugs.skip=true
Expand All @@ -153,15 +160,21 @@ usually the release command is:
```
$ mvn clean install -DskipTests -Pimages -Plegacy
```
if the development command was never run, then plugins profile must be included
if the development command was never run, then plugins profile must be included and `plugins-build.sh` run.
```
$ sh runtime-decompiler/plugins-build.sh
$ mvn clean install -DskipTests -Pimages -Plegacy -PdownloadPlugins
```
Note, that tests requires valid DISPLAY, to have some top level components (like HexEditor) pass

Then, in images/target/runtime-decompiler... `./start.sh` in a *Linux terminal* or `start.bat` in a *Windows CMD* to start the application. The usage of top level start.sh/bat is only for development purposes.

#### Known issues
* `[ERROR] src/main/java/org/kcc/wordsets/JrdApiKeywords.java:[45] (sizes) LineLength: Line is longer than 160 characters (found 13,128).`
The build keeps formatting the file despite itbeing excluded

`git checkout runtime-decompiler/src/main/java/org/kcc/wordsets/JrdApiKeywords.java`

* `mvn clean install` results in `BUILD FAILURE` with the error
`java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty`
(spotted on Windows)
Expand All @@ -182,3 +195,7 @@ Then, in images/target/runtime-decompiler... `./start.sh` in a *Linux terminal*
echo $x ;
mvn test -Dtest="**/*$x" ; done
```

* `bad version? clean .m?` in images/build.log

Clean `~/m2` cahe. Just nitpicked directories are better then all, but all will do.
2 changes: 1 addition & 1 deletion decompiler_agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>java-runtime-decompiler</artifactId>
<groupId>java-runtime-decompiler</groupId>
<version>9.2</version>
<version>${jrd.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class AgentLogger {

private static final String NULL_OBJECT_MESSAGE = "Trying to log null object";

private static class AgentLoggerHolder {
private static final class AgentLoggerHolder {
// https://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom
// https://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java
private static final AgentLogger INSTANCE = new AgentLogger();
Expand Down
4 changes: 2 additions & 2 deletions decompiler_agent/src/main/java/org/jrd/agent/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ private Main() {
* @param inst instance of instrumentation of given VM
*/
public static void premain(final String agentArgs, Instrumentation inst) throws Exception {
String hostname = null;
Integer port = null;
final String loneliness;
// guard against the agent being loaded twice
synchronized (Main.class) {
Expand All @@ -62,6 +60,8 @@ public InstrumentationProvider run() {
return p;
}
});
String hostname = null;
Integer port = null;
if (agentArgs != null) {
String[] argsArray = agentArgs.split(",");
for (String arg : argsArray) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class Transformer implements ClassFileTransformer {

private boolean allowToSaveBytecode = false;
private volatile boolean allowToSaveBytecode = false;
private ClassClassLoaderMap results = new ClassClassLoaderMap();
private ClassClassLoaderMap overrides = new ClassClassLoaderMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class Variables {
* We have to have all internal classes initialized so any later classes can use them without a manual init.
*/
public static void init() {
FakeVariableException.init();
NoSuchFakeVariableException.init();
FakeVariableException.fakeVariableExceptionInit();
NoSuchFakeVariableException.noSuchFakeVariableExceptionInit();
FakeVariableAlreadyDeclaredException.init();
Global.init();
Local.init();
Expand Down Expand Up @@ -47,7 +47,7 @@ public FakeVariableException(Exception ex) {
super(ex);
}

public static void init() {
public static void fakeVariableExceptionInit() {
}

}
Expand All @@ -61,7 +61,7 @@ public NoSuchFakeVariableException(String s) {
super(s);
}

public static void init() {
public static void noSuchFakeVariableExceptionInit() {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class MetadataProperties {
private static final String TIMESTAMP_KEY = "timestamp";
private static final String NAME_KEY = "name";

private static class PropertiesHolder {
private static final class PropertiesHolder {
private static final MetadataProperties INSTANCE = new MetadataProperties();
}

Expand Down
8 changes: 5 additions & 3 deletions images/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ if [ "x$PLUGINS" = "x" ] ; then
fi

if [ "x$VERIFY_CP" = "xTRUE" -a "x$PLUGINS" = "xTRUE" ] ; then
find "$HOME/.m2/repository" -type d | grep -e com/github/mstrobel/ -e org/jboss/windup/decompiler/fernflower -e openjdk/asmtools -e benf/cfr
for x in com/github/mstrobel/ org/jboss/windup/decompiler/fernflower openjdk/asmtools/ asmtools/asmtools-core/ benf/cfr org/jd/jd-core/ ; do
find "$HOME/.m2/repository" -type d | grep -e $x
if [ $? -eq 0 ] ; then
echo "decompilers found in maven repo"
echo "$x decompilers found in maven repo"
else
echo "no decompilers found! run 'mvn clean install -PdownloadPlugins' to obtain decompilers from maven repos or use VERIFY_CP/PLUGINS"
echo "$x no decompilers found! run 'mvn clean install -PdownloadPlugins' and run 'plugins-build.sh' to obtain decompilers from maven repos or use VERIFY_CP/PLUGINS"
exit 1
fi
done
fi

FROM_CP=`mktemp`
Expand Down
6 changes: 3 additions & 3 deletions images/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>java-runtime-decompiler</groupId>
<artifactId>java-runtime-decompiler</artifactId>
<version>9.2</version>
<version>${jrd.version}</version>
<relativePath>../</relativePath>
</parent>

Expand All @@ -22,12 +22,12 @@
<dependency>
<groupId>java-runtime-decompiler</groupId>
<artifactId>runtime-decompiler</artifactId>
<version>9.2</version>
<version>${jrd.version}</version>
</dependency>
<dependency>
<groupId>java-runtime-decompiler</groupId>
<artifactId>decompiler-agent</artifactId>
<version>9.2</version>
<version>${jrd.version}</version>
</dependency>
</dependencies>

Expand Down
13 changes: 7 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
</modules>
<groupId>java-runtime-decompiler</groupId>
<artifactId>java-runtime-decompiler</artifactId>
<version>9.2</version>
<version>${jrd.version}</version>

<properties>
<jrd.root.directory>${project.basedir}</jrd.root.directory>
<plugin.configuration.directory>${jrd.root.directory}/.plugin_config</plugin.configuration.directory>
<jrd.version>10.0</jrd.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.3.0</version>
<version>4.9.6.0</version>
<inherited>true</inherited>

<configuration>
Expand All @@ -49,13 +50,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.6.0</version>

<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.45</version>
<version>11.0.1</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -84,7 +85,7 @@
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.16.0</version>
<version>2.29.0</version>

<configuration>
<encoding>UTF-8</encoding>
Expand All @@ -107,7 +108,7 @@
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.4.0</version>
<version>4.9.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Loading