From 7933cb17f8be4c913e56f57254fd5125ad81c88f Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Tue, 27 Aug 2019 11:56:30 -0500 Subject: [PATCH 01/16] "Adding package.cfg file" --- package.cfg | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 package.cfg diff --git a/package.cfg b/package.cfg new file mode 100644 index 0000000..66ea79d --- /dev/null +++ b/package.cfg @@ -0,0 +1,2 @@ +[koji] +targets = epel8 epel8-playground \ No newline at end of file From b49adb378f9d5781dd29ea3cdacc6c1ccbe863e4 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Tue, 3 Sep 2019 19:39:20 +0200 Subject: [PATCH 02/16] Adding forgotten files --- .gitignore | 2 + fixDoclint.patch | 19 ++++++ java-runtime-decompiler | 86 ++++++++++++++++++++++++ java-runtime-decompiler.1 | 32 +++++++++ java-runtime-decompiler.spec | 124 +++++++++++++++++++++++++++++++++++ jrd.desktop | 8 +++ remove_rsyntaxtextarea.patch | 85 ++++++++++++++++++++++++ sources | 1 + systemFernflower.patch | 16 +++++ systemProcyon.patch | 18 +++++ 10 files changed, 391 insertions(+) create mode 100644 .gitignore create mode 100644 fixDoclint.patch create mode 100644 java-runtime-decompiler create mode 100644 java-runtime-decompiler.1 create mode 100644 java-runtime-decompiler.spec create mode 100644 jrd.desktop create mode 100644 remove_rsyntaxtextarea.patch create mode 100644 sources create mode 100644 systemFernflower.patch create mode 100644 systemProcyon.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4ee33b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/java-runtime-decompiler-2.0.tar.gz +/java-runtime-decompiler-3.0.tar.gz diff --git a/fixDoclint.patch b/fixDoclint.patch new file mode 100644 index 0000000..bdd46dc --- /dev/null +++ b/fixDoclint.patch @@ -0,0 +1,19 @@ +diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java +index 86f9a87..18dce1a 100644 +--- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java ++++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java +@@ -174,11 +174,11 @@ public class MainFrameView { + welcomeJTextArea = new JTextArea(9, 40); + welcomeJTextArea.setText("Welcome to Java-Runtime-Decompiler\n" + + "\n" + +- "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure → Decompiler Agent'.\n" + ++ "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure -> Decompiler Agent'.\n" + + "It's a built-in project and can usually be found at '"+ ((isPortable())?"./libs/":"./decompiler_agent/target/") +"decompiler-agent-*.jar'.\n" + + "\n" + + "Internal javap decompiling tools are available by default.\n" + +- "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure → Plugins'.\n" + ++ "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure -> Plugins'.\n" + + "Currently supported decompilers are: Fernflower, Procyon.\n"); + welcomeJTextArea.setFont(new Font(welcomeJTextArea.getFont().getFontName(), welcomeJTextArea.getFont().getStyle(), 20)); + welcomeJTextArea.setLineWrap(true); + diff --git a/java-runtime-decompiler b/java-runtime-decompiler new file mode 100644 index 0000000..0d14213 --- /dev/null +++ b/java-runtime-decompiler @@ -0,0 +1,86 @@ +#!/usr/bin/bash + +# java runtime decompiler launch script + +# JPackage Project +# Source functions library + +. /usr/share/java-utils/java-functions + +# identify directory tree +JRD=`basename $0` +CONF_HOME=$XDG_CONFIG_HOME + + +if [ "$CONF_HOME" = "" ] ; then + CONF_HOME=$HOME/.config/$JRD + +else + CONF_HOME=$CONF_HOME/$JRD + +fi + +LOG_DIR=$CONF_HOME/logs + +CONF_DIR=$CONF_HOME/conf + +# create directory tree +PLUGIN_HOME=$CONF_HOME/plugins + +mkdir -p $LOG_DIR + +mkdir -p $CONF_DIR + +mkdir -p $PLUGIN_HOME + +: ${MAIN_CLASS:=org.jrd.backend.data.Main} + +# set java and jvm arguments +export _prefer_jre=false +_set_java_home +set_jvm + +# all dependencies must be on classpath +set_classpath java-runtime-decompiler byteman google-gson +CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar + +# set path to agent automatically +AGENT="/usr/share/java/java-runtime-decompiler/decompiler-agent.jar" +CONFIG_FILE=$CONF_DIR/config.cfg +AGENT_PREFIX="AGENT_PATH===" +AGENT_STRING=$AGENT_PREFIX$AGENT + +# copy json wrappers information to home so the users can edit +CP_FILES="$(ls /etc/$JRD/plugins/*.json)" +for cpfile in $CP_FILES; do + FILE_NAME="$(basename -- $cpfile)" + if [ ! -e "$PLUGIN_HOME/$FILE_NAME" ] + then + cp $cpfile $PLUGIN_HOME + else + echo "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten." >&2 + fi +done + +# create config file and add agent default path +touch $CONFIG_FILE + +if [ -e $AGENT ] +then + if grep -Fxq $AGENT_STRING $CONFIG_FILE + then + echo "Default agent path is already set in $CONFIG_FILE. Skipping agent path setting." >&2 + elif grep -rq $AGENT_PREFIX $CONFIG_FILE + then + RESULT_OF_GREP="$(grep -rq $AGENT_PREFIX $CONFIG_FILE)" + echo "Agent path is already set in $CONFIG_FILE as ${RESULT_OF_GREP}. Skipping agent path setting." >&2 + else + echo $AGENT_STRING >> $CONFIG_FILE + + fi +else + echo "Agent was not found and agent path was not set correctly. This has to be done manually in the decompiler GUI, or set AGENT_PATH===path_to_agent_jar in the configuration file: $CONFIG_FILE" >&2 +fi + +run "$@" + diff --git a/java-runtime-decompiler.1 b/java-runtime-decompiler.1 new file mode 100644 index 0000000..eb2cddd --- /dev/null +++ b/java-runtime-decompiler.1 @@ -0,0 +1,32 @@ +.TH java-runtime-decompiler 1 "26 August 2019" "version 3.0" +.SH NAME +java-runtime-decompiler \- launch java-runtime decompiler GUI +.SH SYNOPSIS +java-runtime-decompiler +.SH DESCRIPTION +It is used for extraction of bytecode from running JVM and decompilation of the bytecode with an external decompiler. Paths to the decompiler need to be specified in .json configuration file located in /etc/java-runtime-decompiler +.SH OPTIONS +.IP -verbose +Print out all exceptions and debugging strings in stdout. +.IP -help +Print out help and exits. +.IP -listjvms +List available local JVMs. +.IP -listplugins +List currently configured plugins with their status. +.IP "-listclasses pid-xor-url" +List loaded classes from JVM with given PID/URL. +.IP "-bytes pid class-name" +Print on stdout binary form of given class loaded in JVM with given PID/URL. +.IP "-base64bytes pid-xor-url class-name" +Print on stdout binary form encoded in base64 of given class loaded in JVM with given PID/URL. +.IP "-decompile pid-xor-url class-name config-file" +Print on stdout decompiled class, needs PID/URL of JVM, class name and name/file with decompiler configuration, can use javap disassembler. To pass arguments to the disassembler, add them to javap without spaces (e.g. javap-v). +.IP "-overwrite pid/urlOfJVM classToOverwrite fileWithNewBytecode" +three args - pid or url of JVM and class to overwrite and file with new bytecode +.SH AUTHOR +Petra Alice Mikova (petra.alice.mikova@gmail.com) +Jiri Vanek (judovana@email.com) +Radek Manak (Radek.Manak@protonmail.com) +Ondrej Hrdlicka (ondra.ondrah@seznam.cz) + diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec new file mode 100644 index 0000000..d680bc7 --- /dev/null +++ b/java-runtime-decompiler.spec @@ -0,0 +1,124 @@ +Summary: Application for extraction and decompilation of JVM byte code +Name: java-runtime-decompiler +Version: 3.0 +Release: 4%{?dist} +License: GPLv3 +URL: https://github.com/pmikova/java-runtime-decompiler +Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz +Source1: java-runtime-decompiler +Source2: java-runtime-decompiler.1 +Source3: jrd.desktop +Patch0: remove_rsyntaxtextarea.patch +Patch1: systemFernflower.patch +Patch2: systemProcyon.patch +Patch3: fixDoclint.patch +BuildArch: noarch +BuildRequires: maven-local +BuildRequires: byteman +BuildRequires: junit +BuildRequires: ant-junit +BuildRequires: maven-surefire-provider-junit +BuildRequires: maven-surefire +BuildRequires: maven-surefire-plugin +# depends on devel, not runtime (needs tools.jar) +BuildRequires: java-devel = 1:1.8.0 +BuildRequires: google-gson +BuildRequires: desktop-file-utils +Requires: java-devel = 1:1.8.0 +Recommends: fernflower +Recommends: procyon-decompiler + +%description +This application can access JVM memory at runtime, +extract byte code from the JVM and decompile it. +%package javadoc +Summary: Javadoc for %{name} +Requires: %{name} = %{version}-%{release} + +%description javadoc +This package contains the API documentation for %{name}. + +%prep +%setup -q -n %{name}-%{name}-%{version} +%patch0 -p1 +%patch1 +%patch2 +%patch3 -p1 + +%build +pushd runtime-decompiler +%pom_remove_dep com.sun:tools +%pom_add_dep com.sun:tools +%pom_remove_plugin :maven-jar-plugin +popd +export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" +%mvn_build -f + +%install +%mvn_install +install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1/ +install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/ + +install -d -m 755 $RPM_BUILD_ROOT%{_bindir} +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/ +install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/ +cp -r %{_builddir}/%{name}-%{name}-%{version}/runtime-decompiler/src/plugins/ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/ + +install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications +desktop-file-install --vendor="fedora" \ +--dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE3} + +%files -f .mfiles +%attr(755, root, -) %{_bindir}/java-runtime-decompiler +%{_mandir}/man1/java-runtime-decompiler.1* + +# wrappers for decompilers +%dir %{_sysconfdir}/%{name} +%dir %{_sysconfdir}/%{name}/plugins +%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json +%license LICENSE + +%dir %{_datadir}/applications +%{_datadir}/applications/fedora-jrd.desktop + +%files javadoc -f .mfiles-javadoc +%license LICENSE + +%changelog +* Tue Aug 27 2019 Jiri Vanek - 3.0-3 +- all stdouts from customlauncher moved to stderr + +* Mon Aug 26 2019 Jiri Vanek - 3.0-0 +- moved to usptream version 3.0 +- adjusted configs, removed lambda patch + +* Thu Jul 25 2019 Fedora Release Engineering - 2.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jan 17 2019 Jiri Vanek - 2.0-5 +- improved Patch3, includeLambdas.patch to sort the lamdas t the bottom + +* Thu Jan 17 2019 Jiri Vanek - 2.0-4 +- added depndence of procyon decompiler (currenlty under review +- added and applied Patch2, systemProcyon.patch to enable system procyon out of thebox +- added and applied Patch3, includeLambdas.patch to at least list lamdas untill fixed in upstream + +* Thu Jan 10 2019 Jiri Vanek - 2.0-3 +- added depndence of fernflower decompiler +- added and applied Patch1, systemFernflower.patch to enable system fernflower + +* Wed Nov 28 2018 Petra Mikova - 2.0-2 +- fixed changelog + +* Mon Nov 19 2018 Petra Mikova - 2.0-1 +- fixed issues listed in review (rhbz#1636019) +- added installation of desktop file + +* Wed Jun 06 2018 Petra Mikova - 1.1-1 +- initial commit diff --git a/jrd.desktop b/jrd.desktop new file mode 100644 index 0000000..eb2d468 --- /dev/null +++ b/jrd.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Categories=Development;Profiling;Java; +Version=1.0 +Name=Java Runtime Decompiler +Exec=java-runtime-decompiler +Terminal=false diff --git a/remove_rsyntaxtextarea.patch b/remove_rsyntaxtextarea.patch new file mode 100644 index 0000000..a68d62c --- /dev/null +++ b/remove_rsyntaxtextarea.patch @@ -0,0 +1,85 @@ +diff --git a/runtime-decompiler/pom.xml b/runtime-decompiler/pom.xml +index 26a416e..e6e2425 100644 +--- a/runtime-decompiler/pom.xml ++++ b/runtime-decompiler/pom.xml +@@ -131,11 +131,6 @@ + system + ${java.home}/../lib/tools.jar + +- +- com.fifesoft +- rsyntaxtextarea +- 2.6.1 +- + + org.jboss.byteman + byteman-install +@@ -144,24 +139,6 @@ + + + +- +- org.junit.jupiter +- junit-jupiter-api +- 5.5.0 +- test +- +- +- org.junit.jupiter +- junit-jupiter-params +- 5.5.0 +- test +- +- +- org.junit.jupiter +- junit-jupiter-engine +- 5.5.0 +- test +- + + + +diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java +index 9c19e2c..8d17775 100644 +--- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java ++++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java +@@ -2,9 +2,9 @@ package org.jrd.frontend.MainFrame; + + import org.jrd.backend.core.OutputController; + import org.jrd.backend.decompiling.DecompilerWrapperInformation; +-import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +-import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +-import org.fife.ui.rtextarea.RTextScrollPane; ++//import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; ++//import org.fife.ui.rsyntaxtextarea.SyntaxConstants; ++//import org.fife.ui.rtextarea.RTextScrollPane; + + import javax.swing.*; + import javax.swing.border.EtchedBorder; +@@ -30,8 +30,8 @@ public class BytecodeDecompilerView { + private JPanel rightMainPanel; + private JScrollPane leftScrollPanel; + private JList filteredClassesJlist; +- private RTextScrollPane bytecodeScrollPane; +- private RSyntaxTextArea bytecodeSyntaxTextArea; ++ private JScrollPane bytecodeScrollPane; ++ private JTextArea bytecodeSyntaxTextArea; + private ActionListener bytesActionListener; + private ActionListener classesActionListener; + private ActionListener rewriteActionListener; +@@ -147,10 +147,10 @@ public class BytecodeDecompilerView { + } + }); + +- bytecodeSyntaxTextArea = new RSyntaxTextArea(); +- bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); +- bytecodeSyntaxTextArea.setCodeFoldingEnabled(true); +- bytecodeScrollPane = new RTextScrollPane(bytecodeSyntaxTextArea); ++ bytecodeSyntaxTextArea = new JTextArea(); ++ //bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); ++ //bytecodeSyntaxTextArea.setCodeFoldingEnabled(true); ++ bytecodeScrollPane = new JScrollPane(bytecodeSyntaxTextArea); + + leftMainPanel = new JPanel(); + leftMainPanel.setLayout(new BorderLayout()); + diff --git a/sources b/sources new file mode 100644 index 0000000..d54d342 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (java-runtime-decompiler-3.0.tar.gz) = 329184689763b7777ef0bad1c0f787aa649f855692b52bd843cacd424d5d2c0caadad328f80cd7f229031a151b6414c712bd770abd285412055c5d34d932875c diff --git a/systemFernflower.patch b/systemFernflower.patch new file mode 100644 index 0000000..ecb8d07 --- /dev/null +++ b/systemFernflower.patch @@ -0,0 +1,16 @@ +--- runtime-decompiler/src/plugins/FernflowerDecompilerWrapper.json ++++ runtime-decompiler/src/plugins/FernflowerDecompilerWrapper.json +@@ -1,9 +1,8 @@ + { + "Name": "Fernflower", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/FernflowerDecompilerWrapper.java", ++ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/FernflowerDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/decompiler-fernflower/4.2.1.Final/decompiler-fernflower-4.2.1.Final.jar", +- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/fernflower/windup-fernflower/1.0.0.20171018/windup-fernflower-1.0.0.20171018.jar" ++ "file:///usr/share/java/fernflower.jar" + ], + "DecompilerDownloadURL": "https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine" +-} +\ No newline at end of file ++} diff --git a/systemProcyon.patch b/systemProcyon.patch new file mode 100644 index 0000000..1581df9 --- /dev/null +++ b/systemProcyon.patch @@ -0,0 +1,18 @@ +--- runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,9 +1,10 @@ + { + "Name": "Procyon", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/ProcyonDecompilerWrapper.java", ++ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/ProcyonDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-core/0.5.35/procyon-core-0.5.35.jar", +- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-compilertools/0.5.35/procyon-compilertools-0.5.35.jar" ++ "/usr/share/java/procyon/procyon-core.jar", ++ "/usr/share/java/procyon/procyon-compilertools.jar", ++ "/usr/share/java/procyon/procyon-decompiler.jar" + ], + "DecompilerDownloadURL": "https://bitbucket.org/mstrobel/procyon/downloads/" +-} +\ No newline at end of file ++} From 99a7f90c7389f9f6d399274428208694e557c216 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Thu, 24 Sep 2020 17:58:17 +0000 Subject: [PATCH 03/16] remove package.cfg per new epel-playground policy --- package.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 package.cfg diff --git a/package.cfg b/package.cfg deleted file mode 100644 index 66ea79d..0000000 --- a/package.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[koji] -targets = epel8 epel8-playground \ No newline at end of file From 23354267ba77779934c875c76b4e4376d1525fd4 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Fri, 6 Aug 2021 16:20:02 +0200 Subject: [PATCH 04/16] Bumped to 5.0.beta2 --- .gitignore | 2 + fixDoclint.patch | 4 +- java-runtime-decompiler | 6 +-- java-runtime-decompiler.spec | 75 +++++++++++++++++++++----- remove_rsyntaxtextarea.patch | 101 ++++++++++++++++++----------------- sources | 2 +- systemCfr.patch | 14 +++++ systemFernflower.patch | 9 ++-- systemJasm.patch | 14 +++++ systemJcoder.patch | 14 +++++ systemProcyon.patch | 9 ++-- 11 files changed, 173 insertions(+), 77 deletions(-) create mode 100644 systemCfr.patch create mode 100644 systemJasm.patch create mode 100644 systemJcoder.patch diff --git a/.gitignore b/.gitignore index f4ee33b..4b41dde 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /java-runtime-decompiler-2.0.tar.gz /java-runtime-decompiler-3.0.tar.gz +/java-runtime-decompiler-4.0.tar.gz +/java-runtime-decompiler-5.0.beta2.tar.gz diff --git a/fixDoclint.patch b/fixDoclint.patch index bdd46dc..f863abb 100644 --- a/fixDoclint.patch +++ b/fixDoclint.patch @@ -1,7 +1,7 @@ diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java index 86f9a87..18dce1a 100644 ---- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java -+++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java +--- runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java ++++ runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java @@ -174,11 +174,11 @@ public class MainFrameView { welcomeJTextArea = new JTextArea(9, 40); welcomeJTextArea.setText("Welcome to Java-Runtime-Decompiler\n" + diff --git a/java-runtime-decompiler b/java-runtime-decompiler index 0d14213..f6dfc13 100644 --- a/java-runtime-decompiler +++ b/java-runtime-decompiler @@ -41,7 +41,7 @@ _set_java_home set_jvm # all dependencies must be on classpath -set_classpath java-runtime-decompiler byteman google-gson +set_classpath java-runtime-decompiler byteman google-gson classpathless-compiler CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar # set path to agent automatically @@ -82,5 +82,5 @@ else echo "Agent was not found and agent path was not set correctly. This has to be done manually in the decompiler GUI, or set AGENT_PATH===path_to_agent_jar in the configuration file: $CONFIG_FILE" >&2 fi -run "$@" - +export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true" +run "$@" diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index d680bc7..0a078e9 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,7 +1,7 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler -Version: 3.0 -Release: 4%{?dist} +Version: 5.0.beta2 +Release: 1%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz @@ -11,7 +11,11 @@ Source3: jrd.desktop Patch0: remove_rsyntaxtextarea.patch Patch1: systemFernflower.patch Patch2: systemProcyon.patch -Patch3: fixDoclint.patch +Patch4: systemCfr.patch +Patch5: systemJasm.patch +Patch6: systemJcoder.patch + + BuildArch: noarch BuildRequires: maven-local BuildRequires: byteman @@ -20,17 +24,22 @@ BuildRequires: ant-junit BuildRequires: maven-surefire-provider-junit BuildRequires: maven-surefire BuildRequires: maven-surefire-plugin -# depends on devel, not runtime (needs tools.jar) -BuildRequires: java-devel = 1:1.8.0 +BuildRequires: java-11-devel BuildRequires: google-gson BuildRequires: desktop-file-utils -Requires: java-devel = 1:1.8.0 +BuildRequires: classpathless-compiler +Requires: java-11-openjdk-headless +Recommends: java-11-openjdk +Requires: classpathless-compiler Recommends: fernflower Recommends: procyon-decompiler +Recommends: CFR +Recommends: openjdk-asmtools %description This application can access JVM memory at runtime, extract byte code from the JVM and decompile it. + %package javadoc Summary: Javadoc for %{name} Requires: %{name} = %{version}-%{release} @@ -40,18 +49,19 @@ This package contains the API documentation for %{name}. %prep %setup -q -n %{name}-%{name}-%{version} -%patch0 -p1 -%patch1 -%patch2 -%patch3 -p1 +%patch0 -p0 +%patch1 -p0 +%patch2 -p0 +%patch4 -p0 +%patch5 -p0 +%patch6 -p0 %build pushd runtime-decompiler -%pom_remove_dep com.sun:tools -%pom_add_dep com.sun:tools %pom_remove_plugin :maven-jar-plugin popd export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk %mvn_build -f %install @@ -79,6 +89,12 @@ desktop-file-install --vendor="fedora" \ %config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json %config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java %config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.json %license LICENSE %dir %{_datadir}/applications @@ -88,6 +104,41 @@ desktop-file-install --vendor="fedora" \ %license LICENSE %changelog +* Thu Aug 02 2021 Fedora Release Engineering - 5.0.beta2-1 +- updated to 5.0 +- removed jdk8 subpkg due to compiler api +- added Cfr and asmtools plugins +- todo man page + +* Thu Jul 22 2021 Fedora Release Engineering - 4.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Dec 08 2020 Jiri Vanek - 4.0-2 +- Added subpackage built by jdk8 to allow looking into jdk8 apps +- for some reason, jdk8 vm can not look into jdk11 vm, even if agent is correctly jdk8 version +- the config is still share, which is stupid, but I doubt there is another target audeince then me + +* Tue Dec 08 2020 Jiri Vanek - 4.0-1 +- built by jdk11 + +* Tue Jul 28 2020 Fedora Release Engineering - 3.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jul 10 2020 Jiri Vanek - 3.0-8 +- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11 + +* Tue Mar 17 2020 Jiri Vanek - 3.0-7 +- aligned rsyntaxtextarea version, fixed javadoc generation + +* Tue Mar 17 2020 Jiri Vanek - 3.0-6 +- changed jdk8 requirement + +* Wed Jan 29 2020 Fedora Release Engineering - 3.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Tue Aug 27 2019 Jiri Vanek - 3.0-3 - all stdouts from customlauncher moved to stderr diff --git a/remove_rsyntaxtextarea.patch b/remove_rsyntaxtextarea.patch index a68d62c..76c0671 100644 --- a/remove_rsyntaxtextarea.patch +++ b/remove_rsyntaxtextarea.patch @@ -1,73 +1,52 @@ diff --git a/runtime-decompiler/pom.xml b/runtime-decompiler/pom.xml index 26a416e..e6e2425 100644 ---- a/runtime-decompiler/pom.xml -+++ b/runtime-decompiler/pom.xml -@@ -131,11 +131,6 @@ - system - ${java.home}/../lib/tools.jar - +--- runtime-decompiler/pom.xml ++++ runtime-decompiler/pom.xml +@@ -157,11 +157,6 @@ + directories + 10 + --> - - com.fifesoft - rsyntaxtextarea -- 2.6.1 +- 3.1.2 - org.jboss.byteman byteman-install -@@ -144,24 +139,6 @@ - - - -- -- org.junit.jupiter -- junit-jupiter-api -- 5.5.0 -- test -- -- -- org.junit.jupiter -- junit-jupiter-params -- 5.5.0 -- test -- -- -- org.junit.jupiter -- junit-jupiter-engine -- 5.5.0 -- test -- - - - diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java index 9c19e2c..8d17775 100644 ---- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java -+++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java -@@ -2,9 +2,9 @@ package org.jrd.frontend.MainFrame; - - import org.jrd.backend.core.OutputController; - import org.jrd.backend.decompiling.DecompilerWrapperInformation; +--- runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java ++++ runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java +@@ -4,11 +4,11 @@ import org.fife.ui.hex.event.HexSearchActionListener; + import org.fife.ui.hex.event.HexSearchDocumentListener; + import org.fife.ui.hex.swing.HexEditor; + import org.fife.ui.hex.swing.HexSearch; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -import org.fife.ui.rtextarea.RTextScrollPane; +-import org.fife.ui.rtextarea.SearchContext; +-import org.fife.ui.rtextarea.SearchEngine; +//import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +//import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +//import org.fife.ui.rtextarea.RTextScrollPane; ++//import org.fife.ui.rtextarea.SearchContext; ++//import org.fife.ui.rtextarea.SearchEngine; + import org.jrd.backend.core.OutputController; + import org.jrd.backend.decompiling.DecompilerWrapperInformation; - import javax.swing.*; - import javax.swing.border.EtchedBorder; -@@ -30,8 +30,8 @@ public class BytecodeDecompilerView { - private JPanel rightMainPanel; +@@ -52,8 +52,8 @@ public class BytecodeDecompilerView { + private JPanel rightBin; private JScrollPane leftScrollPanel; private JList filteredClassesJlist; - private RTextScrollPane bytecodeScrollPane; - private RSyntaxTextArea bytecodeSyntaxTextArea; + private JScrollPane bytecodeScrollPane; + private JTextArea bytecodeSyntaxTextArea; - private ActionListener bytesActionListener; - private ActionListener classesActionListener; - private ActionListener rewriteActionListener; -@@ -147,10 +147,10 @@ public class BytecodeDecompilerView { + private HexEditor hex; + private JPanel hexControls; + private String lastDecompiledClass = ""; +@@ -198,10 +198,10 @@ public class BytecodeDecompilerView { } }); @@ -80,6 +59,30 @@ index 9c19e2c..8d17775 100644 + //bytecodeSyntaxTextArea.setCodeFoldingEnabled(true); + bytecodeScrollPane = new JScrollPane(bytecodeSyntaxTextArea); - leftMainPanel = new JPanel(); - leftMainPanel.setLayout(new BorderLayout()); - + hex = new HexEditor(); + hexControls = new JPanel(); +@@ -410,15 +410,15 @@ public class BytecodeDecompilerView { + * Search string in decompiled code + */ + private void searchCode() { +- SearchContext context = new SearchContext(); +- String match = searchCodeField.getText(); +- context.setSearchFor(match); +- context.setWholeWord(false); +- SearchEngine.markAll(bytecodeSyntaxTextArea, context); +- int line = SearchEngine.getNextMatchPos(match, bytecodeSyntaxTextArea.getText(), true, true, false); +- if (line >= 0) { +- bytecodeSyntaxTextArea.setCaretPosition(line); +- } ++// SearchContext context = new SearchContext(); ++// String match = searchCodeField.getText(); ++// context.setSearchFor(match); ++// context.setWholeWord(false); ++// SearchEngine.markAll(bytecodeSyntaxTextArea, context); ++// int line = SearchEngine.getNextMatchPos(match, bytecodeSyntaxTextArea.getText(), true, true, false); ++// if (line >= 0) { ++// bytecodeSyntaxTextArea.setCaretPosition(line); ++// } + } + + private void classWorker(String name) { diff --git a/sources b/sources index d54d342..4b08845 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (java-runtime-decompiler-3.0.tar.gz) = 329184689763b7777ef0bad1c0f787aa649f855692b52bd843cacd424d5d2c0caadad328f80cd7f229031a151b6414c712bd770abd285412055c5d34d932875c +SHA512 (java-runtime-decompiler-5.0.beta2.tar.gz) = 81269e4885f34227ea832c29fdc646a25f65e292ed72783c40b65ba59a1937daf021eac6c3cf2176b8b3b511e62c2ecbf5d72fb4b5f512b99ce4124d0749ba02 diff --git a/systemCfr.patch b/systemCfr.patch new file mode 100644 index 0000000..2a0a77d --- /dev/null +++ b/systemCfr.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/CfrDecompilerWrapper.json ++++ runtime-decompiler/src/plugins/CfrDecompilerWrapper.json +@@ -1,8 +1,8 @@ + { + "Name": "Cfr", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/CfrDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/CfrDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/benf/cfr/0.151/cfr-0.151.jar" ++ "file:/usr/share/java/CFR/cfr.jar" + ], + "DecompilerDownloadURL": "https://www.benf.org/other/cfr/faq.html" + } + diff --git a/systemFernflower.patch b/systemFernflower.patch index ecb8d07..b179e10 100644 --- a/systemFernflower.patch +++ b/systemFernflower.patch @@ -4,13 +4,12 @@ { "Name": "Fernflower", - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/FernflowerDecompilerWrapper.java", -+ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/FernflowerDecompilerWrapper.java", ++ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/FernflowerDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/decompiler-fernflower/4.2.1.Final/decompiler-fernflower-4.2.1.Final.jar", +- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/decompiler-fernflower/5.1.4.Final/decompiler-fernflower-5.1.4.Final.jar", - "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/fernflower/windup-fernflower/1.0.0.20171018/windup-fernflower-1.0.0.20171018.jar" + "file:///usr/share/java/fernflower.jar" ], "DecompilerDownloadURL": "https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine" --} -\ No newline at end of file -+} + } + diff --git a/systemJasm.patch b/systemJasm.patch new file mode 100644 index 0000000..b5099af --- /dev/null +++ b/systemJasm.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/JasmDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JasmDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jasm", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JasmDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JasmDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } + diff --git a/systemJcoder.patch b/systemJcoder.patch new file mode 100644 index 0000000..1454b9e --- /dev/null +++ b/systemJcoder.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/JcoderDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JcoderDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jcoder", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JcoderDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JcoderDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } + diff --git a/systemProcyon.patch b/systemProcyon.patch index 1581df9..342a998 100644 --- a/systemProcyon.patch +++ b/systemProcyon.patch @@ -6,13 +6,12 @@ - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/ProcyonDecompilerWrapper.java", + "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/ProcyonDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-core/0.5.35/procyon-core-0.5.35.jar", -- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-compilertools/0.5.35/procyon-compilertools-0.5.35.jar" +- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-core/0.5.36/procyon-core-0.5.36.jar", +- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-compilertools/0.5.36/procyon-compilertools-0.5.36.jar" + "/usr/share/java/procyon/procyon-core.jar", + "/usr/share/java/procyon/procyon-compilertools.jar", + "/usr/share/java/procyon/procyon-decompiler.jar" ], "DecompilerDownloadURL": "https://bitbucket.org/mstrobel/procyon/downloads/" --} -\ No newline at end of file -+} + } + From 410c63847e1486e996c2fd8c72efdfe12a7cf921 Mon Sep 17 00:00:00 2001 From: Jiri Date: Mon, 9 Aug 2021 18:17:52 +0200 Subject: [PATCH 05/16] Bumped to rc1 and fixed man --- .gitignore | 1 + java-runtime-decompiler.1 | 32 -------------------------------- java-runtime-decompiler.spec | 14 ++++++++------ sources | 2 +- 4 files changed, 10 insertions(+), 39 deletions(-) delete mode 100644 java-runtime-decompiler.1 diff --git a/.gitignore b/.gitignore index 4b41dde..caba84a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /java-runtime-decompiler-3.0.tar.gz /java-runtime-decompiler-4.0.tar.gz /java-runtime-decompiler-5.0.beta2.tar.gz +/java-runtime-decompiler-5.0.rc1.tar.gz diff --git a/java-runtime-decompiler.1 b/java-runtime-decompiler.1 deleted file mode 100644 index eb2cddd..0000000 --- a/java-runtime-decompiler.1 +++ /dev/null @@ -1,32 +0,0 @@ -.TH java-runtime-decompiler 1 "26 August 2019" "version 3.0" -.SH NAME -java-runtime-decompiler \- launch java-runtime decompiler GUI -.SH SYNOPSIS -java-runtime-decompiler -.SH DESCRIPTION -It is used for extraction of bytecode from running JVM and decompilation of the bytecode with an external decompiler. Paths to the decompiler need to be specified in .json configuration file located in /etc/java-runtime-decompiler -.SH OPTIONS -.IP -verbose -Print out all exceptions and debugging strings in stdout. -.IP -help -Print out help and exits. -.IP -listjvms -List available local JVMs. -.IP -listplugins -List currently configured plugins with their status. -.IP "-listclasses pid-xor-url" -List loaded classes from JVM with given PID/URL. -.IP "-bytes pid class-name" -Print on stdout binary form of given class loaded in JVM with given PID/URL. -.IP "-base64bytes pid-xor-url class-name" -Print on stdout binary form encoded in base64 of given class loaded in JVM with given PID/URL. -.IP "-decompile pid-xor-url class-name config-file" -Print on stdout decompiled class, needs PID/URL of JVM, class name and name/file with decompiler configuration, can use javap disassembler. To pass arguments to the disassembler, add them to javap without spaces (e.g. javap-v). -.IP "-overwrite pid/urlOfJVM classToOverwrite fileWithNewBytecode" -three args - pid or url of JVM and class to overwrite and file with new bytecode -.SH AUTHOR -Petra Alice Mikova (petra.alice.mikova@gmail.com) -Jiri Vanek (judovana@email.com) -Radek Manak (Radek.Manak@protonmail.com) -Ondrej Hrdlicka (ondra.ondrah@seznam.cz) - diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 0a078e9..1961a15 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,12 +1,11 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler -Version: 5.0.beta2 -Release: 1%{?dist} +Version: 5.0.rc1 +Release: 2%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz Source1: java-runtime-decompiler -Source2: java-runtime-decompiler.1 Source3: jrd.desktop Patch0: remove_rsyntaxtextarea.patch Patch1: systemFernflower.patch @@ -63,11 +62,12 @@ popd export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" export JAVA_HOME=/usr/lib/jvm/java-11-openjdk %mvn_build -f +java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-5.0-SNAPSHOT.jar org.jrd.backend.data.Help > %{name}.1 %install %mvn_install install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1/ -install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/ +install -m 644 %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/ install -d -m 755 $RPM_BUILD_ROOT%{_bindir} install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/ @@ -81,7 +81,6 @@ desktop-file-install --vendor="fedora" \ %files -f .mfiles %attr(755, root, -) %{_bindir}/java-runtime-decompiler %{_mandir}/man1/java-runtime-decompiler.1* - # wrappers for decompilers %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/plugins @@ -104,7 +103,10 @@ desktop-file-install --vendor="fedora" \ %license LICENSE %changelog -* Thu Aug 02 2021 Fedora Release Engineering - 5.0.beta2-1 +* Mon Aug 09 2021 Fedora Release Engineering - 5.0.rc1-1 +- adapted manpage + +* Mon Aug 02 2021 Fedora Release Engineering - 5.0.beta2-1 - updated to 5.0 - removed jdk8 subpkg due to compiler api - added Cfr and asmtools plugins diff --git a/sources b/sources index 4b08845..0958208 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (java-runtime-decompiler-5.0.beta2.tar.gz) = 81269e4885f34227ea832c29fdc646a25f65e292ed72783c40b65ba59a1937daf021eac6c3cf2176b8b3b511e62c2ecbf5d72fb4b5f512b99ce4124d0749ba02 +SHA512 (java-runtime-decompiler-5.0.rc1.tar.gz) = c864e4847d83a25d241811cec9afe26b7c600e7f57f7c141ce85490936f414385d11334f20fb787fe32e65edb6e6fbf8028e2ca346f00ac6bfd716d6b4328576 From 08a7235a89c209542b5a923a03318517ded9ddde Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 12 Aug 2021 17:33:09 +0200 Subject: [PATCH 06/16] bumped to final sources --- .gitignore | 1 + java-runtime-decompiler.spec | 9 ++++++--- sources | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index caba84a..1bb0ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /java-runtime-decompiler-4.0.tar.gz /java-runtime-decompiler-5.0.beta2.tar.gz /java-runtime-decompiler-5.0.rc1.tar.gz +/java-runtime-decompiler-5.1.tar.gz diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 1961a15..98f296c 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,7 +1,7 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler -Version: 5.0.rc1 -Release: 2%{?dist} +Version: 5.1 +Release: 1%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz @@ -62,7 +62,7 @@ popd export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" export JAVA_HOME=/usr/lib/jvm/java-11-openjdk %mvn_build -f -java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-5.0-SNAPSHOT.jar org.jrd.backend.data.Help > %{name}.1 +java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 %install %mvn_install @@ -103,6 +103,9 @@ desktop-file-install --vendor="fedora" \ %license LICENSE %changelog +* Thu Aug 12 2021 Fedora Release Engineering - 5.1-1 +- bumped to final sources + * Mon Aug 09 2021 Fedora Release Engineering - 5.0.rc1-1 - adapted manpage diff --git a/sources b/sources index 0958208..12c4568 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (java-runtime-decompiler-5.0.rc1.tar.gz) = c864e4847d83a25d241811cec9afe26b7c600e7f57f7c141ce85490936f414385d11334f20fb787fe32e65edb6e6fbf8028e2ca346f00ac6bfd716d6b4328576 +SHA512 (java-runtime-decompiler-5.1.tar.gz) = 0a1e644696c7fc0595a9b4ca05ef1f392a78e5a6bb6e9631ede8a93776740ae8cf65ced0cfaacd7890985ee659e41947bcf17a87d7bc3ba5958ae84a943b64d9 From aeb9c030dcce0b7dc77c014230b1140202dbd5ec Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 12 Aug 2021 17:50:02 +0200 Subject: [PATCH 07/16] Now calling jdk11 to generate manpage --- java-runtime-decompiler.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 98f296c..d588249 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -62,7 +62,7 @@ popd export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" export JAVA_HOME=/usr/lib/jvm/java-11-openjdk %mvn_build -f -java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 +$JAVA_HOME/bin/java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 %install %mvn_install From b95081725a927d76122e7c52acd5fde41be62807 Mon Sep 17 00:00:00 2001 From: Jiri Date: Fri, 7 Jan 2022 18:42:23 +0100 Subject: [PATCH 08/16] updated to 6.1 Sync with fedora --- .gitignore | 4 ++ fixDoclint.patch | 19 -------- java-runtime-decompiler | 19 ++++++-- java-runtime-decompiler.spec | 40 +++++++++++++--- removeMultilineSpotbugs.patch | 39 ++++++++++++++++ remove_rsyntaxtextarea.patch | 88 ----------------------------------- rsyntaxVersion.patch | 12 +++++ sources | 2 +- systemJcoder.patch | 2 +- 9 files changed, 105 insertions(+), 120 deletions(-) delete mode 100644 fixDoclint.patch create mode 100644 removeMultilineSpotbugs.patch delete mode 100644 remove_rsyntaxtextarea.patch create mode 100644 rsyntaxVersion.patch diff --git a/.gitignore b/.gitignore index 1bb0ab1..c014da0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ /java-runtime-decompiler-5.0.beta2.tar.gz /java-runtime-decompiler-5.0.rc1.tar.gz /java-runtime-decompiler-5.1.tar.gz +/java-runtime-decompiler-6.0.0.pre.1.tar.gz +/java-runtime-decompiler-6.0.0.pre.2.tar.gz +/java-runtime-decompiler-6.0.0.pre.3.tar.gz +/java-runtime-decompiler-6.1.tar.gz diff --git a/fixDoclint.patch b/fixDoclint.patch deleted file mode 100644 index f863abb..0000000 --- a/fixDoclint.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java -index 86f9a87..18dce1a 100644 ---- runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java -+++ runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java -@@ -174,11 +174,11 @@ public class MainFrameView { - welcomeJTextArea = new JTextArea(9, 40); - welcomeJTextArea.setText("Welcome to Java-Runtime-Decompiler\n" + - "\n" + -- "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure → Decompiler Agent'.\n" + -+ "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure -> Decompiler Agent'.\n" + - "It's a built-in project and can usually be found at '"+ ((isPortable())?"./libs/":"./decompiler_agent/target/") +"decompiler-agent-*.jar'.\n" + - "\n" + - "Internal javap decompiling tools are available by default.\n" + -- "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure → Plugins'.\n" + -+ "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure -> Plugins'.\n" + - "Currently supported decompilers are: Fernflower, Procyon.\n"); - welcomeJTextArea.setFont(new Font(welcomeJTextArea.getFont().getFontName(), welcomeJTextArea.getFont().getStyle(), 20)); - welcomeJTextArea.setLineWrap(true); - diff --git a/java-runtime-decompiler b/java-runtime-decompiler index f6dfc13..8d2082d 100644 --- a/java-runtime-decompiler +++ b/java-runtime-decompiler @@ -7,6 +7,15 @@ . /usr/share/java-utils/java-functions +echo $@ | grep -q -e "-verbose" +verbose=$? + +function warning() { + if [ $verbose -eq 0 ] ; then + echo ${1} >&2 + fi +} + # identify directory tree JRD=`basename $0` CONF_HOME=$XDG_CONFIG_HOME @@ -41,7 +50,7 @@ _set_java_home set_jvm # all dependencies must be on classpath -set_classpath java-runtime-decompiler byteman google-gson classpathless-compiler +set_classpath java-runtime-decompiler rsyntaxtextarea byteman google-gson classpathless-compiler objectweb-asm CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar # set path to agent automatically @@ -58,7 +67,7 @@ for cpfile in $CP_FILES; do then cp $cpfile $PLUGIN_HOME else - echo "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten." >&2 + warning "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten." fi done @@ -69,11 +78,11 @@ if [ -e $AGENT ] then if grep -Fxq $AGENT_STRING $CONFIG_FILE then - echo "Default agent path is already set in $CONFIG_FILE. Skipping agent path setting." >&2 + warning "Default agent path is already set in $CONFIG_FILE. Skipping agent path setting." elif grep -rq $AGENT_PREFIX $CONFIG_FILE then RESULT_OF_GREP="$(grep -rq $AGENT_PREFIX $CONFIG_FILE)" - echo "Agent path is already set in $CONFIG_FILE as ${RESULT_OF_GREP}. Skipping agent path setting." >&2 + warning "Agent path is already set in $CONFIG_FILE as ${RESULT_OF_GREP}. Skipping agent path setting." else echo $AGENT_STRING >> $CONFIG_FILE @@ -82,5 +91,5 @@ else echo "Agent was not found and agent path was not set correctly. This has to be done manually in the decompiler GUI, or set AGENT_PATH===path_to_agent_jar in the configuration file: $CONFIG_FILE" >&2 fi -export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true" +export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED" # jdk11+ do not allow attach by default; jdk17 is hiding javap api run "$@" diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index d588249..8b9570f 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,28 +1,33 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler -Version: 5.1 +Version: 6.1 Release: 1%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz Source1: java-runtime-decompiler Source3: jrd.desktop -Patch0: remove_rsyntaxtextarea.patch Patch1: systemFernflower.patch Patch2: systemProcyon.patch +Patch3: rsyntaxVersion.patch Patch4: systemCfr.patch Patch5: systemJasm.patch Patch6: systemJcoder.patch - +Patch7: removeMultilineSpotbugs.patch BuildArch: noarch BuildRequires: maven-local BuildRequires: byteman +BuildRequires: rsyntaxtextarea +BuildRequires: junit5 +BuildRequires: ant-junit5 BuildRequires: junit BuildRequires: ant-junit BuildRequires: maven-surefire-provider-junit +BuildRequires: maven-surefire-provider-junit5 BuildRequires: maven-surefire BuildRequires: maven-surefire-plugin +BuildRequires: maven-clean-plugin BuildRequires: java-11-devel BuildRequires: google-gson BuildRequires: desktop-file-utils @@ -48,20 +53,32 @@ This package contains the API documentation for %{name}. %prep %setup -q -n %{name}-%{name}-%{version} -%patch0 -p0 %patch1 -p0 %patch2 -p0 +%patch3 -p0 %patch4 -p0 %patch5 -p0 %patch6 -p0 +%patch7 -p1 %build pushd runtime-decompiler %pom_remove_plugin :maven-jar-plugin popd -export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" +%pom_remove_plugin :spotbugs-maven-plugin +%pom_remove_plugin :maven-checkstyle-plugin +%pom_remove_plugin :formatter-maven-plugin +%pom_remove_dep :spotbugs-annotations +a=`find | grep ".*\.java$"` +for x in $a ; do + #grep -e ".*SuppressFBWarnings.*" $x && echo "^ $x ^" + sed "s/.*SuppressFBWarnings.*//g" $x -i +done + +#export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" export JAVA_HOME=/usr/lib/jvm/java-11-openjdk -%mvn_build -f + +%mvn_build -f --xmvn-javadoc -- -Plegacy $JAVA_HOME/bin/java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 %install @@ -103,6 +120,17 @@ desktop-file-install --vendor="fedora" \ %license LICENSE %changelog +* Sun Dec 26 2021 Fedora Release Engineering - 6.0.0.pre.3-1 +- bumped sources to upstream rc candidate + +* Sun Dec 26 2021 Fedora Release Engineering - 6.0.0.pre.2-1 +- bumped sources to upstream pre release + +* Thu Aug 12 2021 Fedora Release Engineering - 6.0.0.pre.1-1 +- umped sources to upstream pre release +- adapted jcoder plugin +- todo, patch for removed plugins + * Thu Aug 12 2021 Fedora Release Engineering - 5.1-1 - bumped to final sources diff --git a/removeMultilineSpotbugs.patch b/removeMultilineSpotbugs.patch new file mode 100644 index 0000000..51763b5 --- /dev/null +++ b/removeMultilineSpotbugs.patch @@ -0,0 +1,39 @@ +--- a/runtime-decompiler/src/main/java/org/jrd/backend/core/DecompilerRequestReceiver.java ++++ a/runtime-decompiler/src/main/java/org/jrd/backend/core/XDecompilerRequestReceiver.java +@@ -262,10 +262,6 @@ + private static class ClassesComparator implements Comparator, Serializable { + + @SuppressWarnings({"ReturnCount", "CyclomaticComplexity"}) // comparator syntax +- @SuppressFBWarnings( +- value = "NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE", +- justification = "False report of possible NP dereference, despite testing both o1 & o2 for nullness." +- ) + @Override + public int compare(ClassInfo c1, ClassInfo c2) { + if (c1 == null && c2 == null) { +--- a/runtime-decompiler/src/main/java/org/jrd/backend/data/VmInfo.java ++++ a/runtime-decompiler/src/main/java/org/jrd/backend/data/XVmInfo.java +@@ -112,10 +112,6 @@ + this.type = local; + } + +- @SuppressFBWarnings( +- value = "NP_LOAD_OF_KNOWN_NULL_VALUE", +- justification = "Classpath is only used for FS VMs, in other cases getCp() does not get called" +- ) + public void setCp(List cp) { + if (cp == null) { + this.cp = null; +--- a/runtime-decompiler/src/test/java/org/jrd/frontend/frame/plugins/FileSelectorArrayRowTest.java ++++ a/runtime-decompiler/src/test/java/org/jrd/frontend/frame/plugins/XFileSelectorArrayRowTest.java +@@ -11,9 +11,6 @@ + import java.io.File; + import java.nio.file.Paths; + +-@SuppressFBWarnings( +- value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "Hardcoded paths aren't used for manipulating with an actual filesystem." +-) + class FileSelectorArrayRowTest { + @BeforeAll + static void setup() { + diff --git a/remove_rsyntaxtextarea.patch b/remove_rsyntaxtextarea.patch deleted file mode 100644 index 76c0671..0000000 --- a/remove_rsyntaxtextarea.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/runtime-decompiler/pom.xml b/runtime-decompiler/pom.xml -index 26a416e..e6e2425 100644 ---- runtime-decompiler/pom.xml -+++ runtime-decompiler/pom.xml -@@ -157,11 +157,6 @@ - directories - 10 - --> -- -- com.fifesoft -- rsyntaxtextarea -- 3.1.2 -- - - org.jboss.byteman - byteman-install -diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java -index 9c19e2c..8d17775 100644 ---- runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java -+++ runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java -@@ -4,11 +4,11 @@ import org.fife.ui.hex.event.HexSearchActionListener; - import org.fife.ui.hex.event.HexSearchDocumentListener; - import org.fife.ui.hex.swing.HexEditor; - import org.fife.ui.hex.swing.HexSearch; --import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; --import org.fife.ui.rsyntaxtextarea.SyntaxConstants; --import org.fife.ui.rtextarea.RTextScrollPane; --import org.fife.ui.rtextarea.SearchContext; --import org.fife.ui.rtextarea.SearchEngine; -+//import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -+//import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -+//import org.fife.ui.rtextarea.RTextScrollPane; -+//import org.fife.ui.rtextarea.SearchContext; -+//import org.fife.ui.rtextarea.SearchEngine; - import org.jrd.backend.core.OutputController; - import org.jrd.backend.decompiling.DecompilerWrapperInformation; - -@@ -52,8 +52,8 @@ public class BytecodeDecompilerView { - private JPanel rightBin; - private JScrollPane leftScrollPanel; - private JList filteredClassesJlist; -- private RTextScrollPane bytecodeScrollPane; -- private RSyntaxTextArea bytecodeSyntaxTextArea; -+ private JScrollPane bytecodeScrollPane; -+ private JTextArea bytecodeSyntaxTextArea; - private HexEditor hex; - private JPanel hexControls; - private String lastDecompiledClass = ""; -@@ -198,10 +198,10 @@ public class BytecodeDecompilerView { - } - }); - -- bytecodeSyntaxTextArea = new RSyntaxTextArea(); -- bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); -- bytecodeSyntaxTextArea.setCodeFoldingEnabled(true); -- bytecodeScrollPane = new RTextScrollPane(bytecodeSyntaxTextArea); -+ bytecodeSyntaxTextArea = new JTextArea(); -+ //bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); -+ //bytecodeSyntaxTextArea.setCodeFoldingEnabled(true); -+ bytecodeScrollPane = new JScrollPane(bytecodeSyntaxTextArea); - - hex = new HexEditor(); - hexControls = new JPanel(); -@@ -410,15 +410,15 @@ public class BytecodeDecompilerView { - * Search string in decompiled code - */ - private void searchCode() { -- SearchContext context = new SearchContext(); -- String match = searchCodeField.getText(); -- context.setSearchFor(match); -- context.setWholeWord(false); -- SearchEngine.markAll(bytecodeSyntaxTextArea, context); -- int line = SearchEngine.getNextMatchPos(match, bytecodeSyntaxTextArea.getText(), true, true, false); -- if (line >= 0) { -- bytecodeSyntaxTextArea.setCaretPosition(line); -- } -+// SearchContext context = new SearchContext(); -+// String match = searchCodeField.getText(); -+// context.setSearchFor(match); -+// context.setWholeWord(false); -+// SearchEngine.markAll(bytecodeSyntaxTextArea, context); -+// int line = SearchEngine.getNextMatchPos(match, bytecodeSyntaxTextArea.getText(), true, true, false); -+// if (line >= 0) { -+// bytecodeSyntaxTextArea.setCaretPosition(line); -+// } - } - - private void classWorker(String name) { diff --git a/rsyntaxVersion.patch b/rsyntaxVersion.patch new file mode 100644 index 0000000..cf084ca --- /dev/null +++ b/rsyntaxVersion.patch @@ -0,0 +1,12 @@ +--- runtime-decompiler/pom.xml ++++ runtime-decompiler/pom.xml +@@ -134,7 +134,7 @@ + + com.fifesoft + rsyntaxtextarea +- 3.1.2 ++ 3.1.1 + + + org.jboss.byteman + diff --git a/sources b/sources index 12c4568..2c65d53 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (java-runtime-decompiler-5.1.tar.gz) = 0a1e644696c7fc0595a9b4ca05ef1f392a78e5a6bb6e9631ede8a93776740ae8cf65ced0cfaacd7890985ee659e41947bcf17a87d7bc3ba5958ae84a943b64d9 +SHA512 (java-runtime-decompiler-6.1.tar.gz) = 41bd87f0311d47819107fbd34173e4e1cebef71eb8651a337fb71a30947ffbb6bcaea6877508e0a02b0b2fcead7fe51497ed6251329a0254a8ee48220275e86f diff --git a/systemJcoder.patch b/systemJcoder.patch index 1454b9e..bdbacc7 100644 --- a/systemJcoder.patch +++ b/systemJcoder.patch @@ -6,7 +6,7 @@ - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JcoderDecompilerWrapper.java", + "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JcoderDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/openjdk/asmtools/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" + "file:/usr/share/java/openjdk-asmtools/asmtools-core.jar" ], "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" From 2c4003972b4bb8b1daca29490824af45ff860d61 Mon Sep 17 00:00:00 2001 From: Jiri Date: Fri, 7 Jan 2022 18:55:07 +0100 Subject: [PATCH 09/16] Remove unit5 as no available in epel --- java-runtime-decompiler.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 8b9570f..0cb33c4 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -19,12 +19,12 @@ BuildArch: noarch BuildRequires: maven-local BuildRequires: byteman BuildRequires: rsyntaxtextarea -BuildRequires: junit5 -BuildRequires: ant-junit5 +#BuildRequires: junit5 +#BuildRequires: ant-junit5 BuildRequires: junit BuildRequires: ant-junit BuildRequires: maven-surefire-provider-junit -BuildRequires: maven-surefire-provider-junit5 +#BuildRequires: maven-surefire-provider-junit5 BuildRequires: maven-surefire BuildRequires: maven-surefire-plugin BuildRequires: maven-clean-plugin From f7d5b260a3b4147594725160b2ae5e6485ca9517 Mon Sep 17 00:00:00 2001 From: Jiri Date: Sat, 8 Jan 2022 09:20:02 +0100 Subject: [PATCH 10/16] Moved to hardcoded jdk11 --- java-runtime-decompiler | 3 +++ java-runtime-decompiler.spec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/java-runtime-decompiler b/java-runtime-decompiler index 8d2082d..e34a307 100644 --- a/java-runtime-decompiler +++ b/java-runtime-decompiler @@ -44,6 +44,9 @@ mkdir -p $PLUGIN_HOME : ${MAIN_CLASS:=org.jrd.backend.data.Main} +if [ "x$JAVA_HOME" == "x" ] ; then + JAVA_HOME=/usr/lib/jvm/java-11-openjdk +fi # set java and jvm arguments export _prefer_jre=false _set_java_home diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 0cb33c4..bd3fdc0 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,7 +1,7 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler Version: 6.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz From bedecc265030f817dde5004a26c5e4a6dd181830 Mon Sep 17 00:00:00 2001 From: Jiri Date: Mon, 3 Jul 2023 18:00:21 +0200 Subject: [PATCH 11/16] Bumped to latest 7.3. Most likely many deps missing. Will be added later --- .gitignore | 3 + java-runtime-decompiler | 46 ++++---- java-runtime-decompiler.spec | 196 ++++++++++++++++++++++++++++------ jrd-hex.desktop | 9 ++ jrd.desktop | 1 + removeMultilineSpotbugs.patch | 13 +++ sources | 2 +- systemJasm.patch | 5 +- systemJasm7.patch | 13 +++ systemJasmG.patch | 13 +++ systemJasmG7.patch | 13 +++ systemJcoder.patch | 4 +- systemJcoder7.patch | 14 +++ systemJcoderG.patch | 14 +++ systemJcoderG7.patch | 14 +++ systemProcyon.patch | 17 +-- systemProcyonAssembler.patch | 20 ++++ 17 files changed, 328 insertions(+), 69 deletions(-) create mode 100644 jrd-hex.desktop create mode 100644 systemJasm7.patch create mode 100644 systemJasmG.patch create mode 100644 systemJasmG7.patch create mode 100644 systemJcoder7.patch create mode 100644 systemJcoderG.patch create mode 100644 systemJcoderG7.patch create mode 100644 systemProcyonAssembler.patch diff --git a/.gitignore b/.gitignore index c014da0..5c6e117 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ /java-runtime-decompiler-6.0.0.pre.2.tar.gz /java-runtime-decompiler-6.0.0.pre.3.tar.gz /java-runtime-decompiler-6.1.tar.gz +/java-runtime-decompiler-7.1.tar.gz +/java-runtime-decompiler-7.2.tar.gz +/java-runtime-decompiler-7.3.tar.gz diff --git a/java-runtime-decompiler b/java-runtime-decompiler index e34a307..df6ccc7 100644 --- a/java-runtime-decompiler +++ b/java-runtime-decompiler @@ -16,44 +16,35 @@ function warning() { fi } -# identify directory tree -JRD=`basename $0` +# the launcher is reused uder different name, hardcoding name +JRD=java-runtime-decompiler CONF_HOME=$XDG_CONFIG_HOME if [ "$CONF_HOME" = "" ] ; then CONF_HOME=$HOME/.config/$JRD - else CONF_HOME=$CONF_HOME/$JRD - fi LOG_DIR=$CONF_HOME/logs - CONF_DIR=$CONF_HOME/conf - -# create directory tree PLUGIN_HOME=$CONF_HOME/plugins +PLUGIN_HOME_LEGACY=$CONF_HOME/plugins-legacy mkdir -p $LOG_DIR - mkdir -p $CONF_DIR - mkdir -p $PLUGIN_HOME : ${MAIN_CLASS:=org.jrd.backend.data.Main} -if [ "x$JAVA_HOME" == "x" ] ; then - JAVA_HOME=/usr/lib/jvm/java-11-openjdk -fi # set java and jvm arguments -export _prefer_jre=false +export _prefer_jre=false #although java moved compiler classes to jre, PREFERING jdk should not hurt _set_java_home set_jvm # all dependencies must be on classpath -set_classpath java-runtime-decompiler rsyntaxtextarea byteman google-gson classpathless-compiler objectweb-asm +set_classpath java-runtime-decompiler rsyntaxtextarea byteman google-gson classpathless-compiler objectweb-asm java-diff-utils CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar # set path to agent automatically @@ -63,16 +54,19 @@ AGENT_PREFIX="AGENT_PATH===" AGENT_STRING=$AGENT_PREFIX$AGENT # copy json wrappers information to home so the users can edit -CP_FILES="$(ls /etc/$JRD/plugins/*.json)" -for cpfile in $CP_FILES; do - FILE_NAME="$(basename -- $cpfile)" - if [ ! -e "$PLUGIN_HOME/$FILE_NAME" ] - then - cp $cpfile $PLUGIN_HOME - else - warning "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten." - fi -done +if [ ! -e "$PLUGIN_HOME_LEGACY" -a -e "$PLUGIN_HOME" ] ; then + mv "$PLUGIN_HOME" "$PLUGIN_HOME_LEGACY" + echo "jrd no longer handles custom plugins for you. Your's " + echo "$PLUGIN_HOME was moved to $PLUGIN_HOME_LEGACY" + echo "You can play with custom plugins in $PLUGIN_HOME" + echo "but keep $PLUGIN_HOME_LEGACY created, so it is not renamed again" +fi +mkdir -p $PLUGIN_HOME_LEGACY + +warning "jrd no longer handles custom plugins for you. Your's " +warning echo "$PLUGIN_HOME was moved to $PLUGIN_HOME_LEGACY" +warning "You can play with custom plugins in $PLUGIN_HOME" +warning "but keep $PLUGIN_HOME_LEGACY created, so it is not renamed again" # create config file and add agent default path touch $CONFIG_FILE @@ -94,5 +88,5 @@ else echo "Agent was not found and agent path was not set correctly. This has to be done manually in the decompiler GUI, or set AGENT_PATH===path_to_agent_jar in the configuration file: $CONFIG_FILE" >&2 fi -export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED" # jdk11+ do not allow attach by default; jdk17 is hiding javap api -run "$@" +export FLAGS="$FLAGS -Djdk.attach.allowAttachSelf=true --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED" # jdk11+ do not allow attach by default; jdk17 is hiding javap api +run "$@" diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index bd3fdc0..40262ac 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,21 +1,30 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler -Version: 6.1 -Release: 2%{?dist} +Version: 7.3 +Release: 1%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz -Source1: java-runtime-decompiler +Source1: %{name} Source3: jrd.desktop +Source4: jrd-hex.desktop Patch1: systemFernflower.patch Patch2: systemProcyon.patch +Patch21: systemProcyonAssembler.patch Patch3: rsyntaxVersion.patch Patch4: systemCfr.patch Patch5: systemJasm.patch +Patch51: systemJasm7.patch +Patch52: systemJasmG.patch +Patch53: systemJasmG7.patch Patch6: systemJcoder.patch +Patch61: systemJcoder7.patch +Patch62: systemJcoderG.patch +Patch63: systemJcoderG7.patch Patch7: removeMultilineSpotbugs.patch BuildArch: noarch +ExclusiveArch: %{java_arches} noarch BuildRequires: maven-local BuildRequires: byteman BuildRequires: rsyntaxtextarea @@ -23,6 +32,7 @@ BuildRequires: rsyntaxtextarea #BuildRequires: ant-junit5 BuildRequires: junit BuildRequires: ant-junit +BuildRequires: java-diff-utils BuildRequires: maven-surefire-provider-junit #BuildRequires: maven-surefire-provider-junit5 BuildRequires: maven-surefire @@ -32,17 +42,23 @@ BuildRequires: java-11-devel BuildRequires: google-gson BuildRequires: desktop-file-utils BuildRequires: classpathless-compiler +Requires: google-gson +Requires: byteman +Requires: rsyntaxtextarea Requires: java-11-openjdk-headless -Recommends: java-11-openjdk Requires: classpathless-compiler -Recommends: fernflower -Recommends: procyon-decompiler -Recommends: CFR -Recommends: openjdk-asmtools +Requires: java-diff-utils +Recommends: java-11-openjdk +Recommends: %{name}-fernflower-plugin +Recommends: %{name}-procyon-plugin +Recommends: %{name}-cfr-plugin +Recommends: %{name}-asmtools-plugin +Recommends: %{name}-asmtools7-plugin %description -This application can access JVM memory at runtime, -extract byte code from the JVM and decompile it. +This application can access JVM at runtime, +extract byte code from the JVM and decompile it, modify the obtained code and compile it back. +It also works with local classpath and source path and provide standalone hex, with binary diff. %package javadoc Summary: Javadoc for %{name} @@ -51,14 +67,61 @@ Requires: %{name} = %{version}-%{release} %description javadoc This package contains the API documentation for %{name}. +%package fernflower-plugin +Requires: fernflower +Summary: fernflower decompiler plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description fernflower-plugin +This package provides bindings and requirements to fernflower decompiler for %{name}. + +%package procyon-plugin +Requires: procyon-decompiler >= 0.6 +Summary: procyon decompiler plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description procyon-plugin +This package provides bindings and requirements to procyon decompiler for %{name}. + +%package cfr-plugin +Requires: CFR +Summary: CFR decompiler plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description cfr-plugin +This package provides bindings and requirements to CFR decompiler for %{name}. + +%package asmtools-plugin +Requires: openjdk-asmtools >= 8.0.b02.ea-0.3.20230113 +Summary: asmtools disassembler and assembler plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description asmtools-plugin +This package provides bindings and requirements to asmtools disassembler and assembler for %{name}. + +%package asmtools7-plugin +Requires: openjdk-asmtools7 +Summary: asmtools7 disassembler and assembler plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description asmtools7-plugin +This package provides bindings and requirements to asmtools7 disassembler and assembler for %{name}. + %prep %setup -q -n %{name}-%{name}-%{version} %patch1 -p0 %patch2 -p0 +%patch21 -p0 %patch3 -p0 %patch4 -p0 %patch5 -p0 +%patch51 -p0 +%patch52 -p0 +%patch53 -p0 %patch6 -p0 +%patch61 -p0 +%patch62 -p0 +%patch63 -p0 %patch7 -p1 %build @@ -74,52 +137,125 @@ for x in $a ; do #grep -e ".*SuppressFBWarnings.*" $x && echo "^ $x ^" sed "s/.*SuppressFBWarnings.*//g" $x -i done - -#export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none" -export JAVA_HOME=/usr/lib/jvm/java-11-openjdk - +xmvn --version +echo $JAVA_HOME +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk #why? +xmvn --version %mvn_build -f --xmvn-javadoc -- -Plegacy -$JAVA_HOME/bin/java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 +CPLC=/usr/share/java/classpathless-compiler +java -cp $CPLC/classpathless-compiler.jar:$CPLC/classpathless-compiler-api.jar:$CPLC/classpathless-compiler-util.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.cli.Help > %{name}.1 %install %mvn_install install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1/ install -m 644 %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/ +pushd $RPM_BUILD_ROOT%{_mandir}/man1/ + ln -s %{name}.1 jrd.1 + ln -s %{name}.1 %{name}-hex.1 + ln -s %{name}.1 jrd-hex.1 +popd install -d -m 755 $RPM_BUILD_ROOT%{_bindir} install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/ install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/ +pushd $RPM_BUILD_ROOT%{_bindir} + cp %{name} %{name}-hex + sed 's/^run .*/run -hex "$@"/' -i %{name}-hex + ln -s %{name} jrd + ln -s %{name}-hex jrd-hex +popd + cp -r %{_builddir}/%{name}-%{name}-%{version}/runtime-decompiler/src/plugins/ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/ install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications -desktop-file-install --vendor="fedora" \ ---dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE3} +desktop-file-install --vendor="fedora" --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE3} +desktop-file-install --vendor="fedora" --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE4} + +#jd is not yet packed and sucks anyway +rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/plugins/JdDecompilerWrapper.java +rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/plugins/JdDecompilerWrapper.json %files -f .mfiles %attr(755, root, -) %{_bindir}/java-runtime-decompiler -%{_mandir}/man1/java-runtime-decompiler.1* +%attr(755, root, -) %{_bindir}/java-runtime-decompiler-hex +%{_bindir}/jrd +%{_bindir}/jrd-hex +%{_mandir}/man1/java-runtime-decompiler*.1* +%{_mandir}/man1/jrd*.1* # wrappers for decompilers %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/plugins -%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java -%config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json -%config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java -%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json -%config %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.java -%config(noreplace) %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.json -%config %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.java -%config(noreplace) %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.json -%config %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.java -%config(noreplace) %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.json -%license LICENSE - %dir %{_datadir}/applications %{_datadir}/applications/fedora-jrd.desktop +%{_datadir}/applications/fedora-jrd-hex.desktop + +%files fernflower-plugin +%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json + +%files procyon-plugin +%config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/ProcyonAssemblerDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonAssemblerDecompilerWrapper.json + +%files cfr-plugin +%config %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/CfrDecompilerWrapper.json + +%files asmtools-plugin +%config %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JasmDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JasmGDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JasmGDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JcoderDecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JcoderGDecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JcoderGDecompilerWrapper.json + +%files asmtools7-plugin +%config %{_sysconfdir}/%{name}/plugins/Jasm7DecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/Jasm7DecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JasmG7DecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JasmG7DecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/Jcoder7DecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/Jcoder7DecompilerWrapper.json +%config %{_sysconfdir}/%{name}/plugins/JcoderG7DecompilerWrapper.java +%config(noreplace) %{_sysconfdir}/%{name}/plugins/JcoderG7DecompilerWrapper.json +%license LICENSE %files javadoc -f .mfiles-javadoc %license LICENSE %changelog +* Fri Jun 30 2023 Fedora Release Engineering - 7.3-1 +- moved to 7.3 +- https://github.com/pmikova/java-runtime-decompiler/releases/tag/java-runtime-decompiler-7.3 +- https://github.com/pmikova/java-runtime-decompiler/releases/tag/java-runtime-decompiler-7.2 + +* Wed Mar 15 2023 Fedora Release Engineering - 7.1-1 +- https://github.com/pmikova/java-runtime-decompiler/releases/tag/java-runtime-decompiler-7.1 +- moved to jrd 7.1 +- added desp on java-diff and new cplc +- fixed(?) procyon wrapper + - todo procyon crashes witout trace +- removed jd wrapper (was new in 7.1, maybe will be added) +- split plugins to subpkgs +- added jrd-hex launcher +- added hex launcher, added jrd symlinks + +* Thu Jul 21 2022 Fedora Release Engineering - 6.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri Jul 08 2022 Jiri Vanek - 6.1-4 +- Rebuilt for Drop i686 JDKs + +* Sat Feb 05 2022 Jiri Vanek - 6.1-3 +- Rebuilt for java-17-openjdk as system jdk + +* Thu Jan 20 2022 Fedora Release Engineering - 6.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Sun Dec 26 2021 Fedora Release Engineering - 6.0.0.pre.3-1 - bumped sources to upstream rc candidate diff --git a/jrd-hex.desktop b/jrd-hex.desktop new file mode 100644 index 0000000..a0db405 --- /dev/null +++ b/jrd-hex.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Categories=Development;Profiling;Java; +Version=1.0 +Name=Java Runtime Decompiler Hex editor +Exec=java-runtime-decompiler-hex +Terminal=false +Name[en_US]=jrd-hex.desktop diff --git a/jrd.desktop b/jrd.desktop index eb2d468..70a9f2b 100644 --- a/jrd.desktop +++ b/jrd.desktop @@ -6,3 +6,4 @@ Version=1.0 Name=Java Runtime Decompiler Exec=java-runtime-decompiler Terminal=false +Name[en_US]=jrd.desktop diff --git a/removeMultilineSpotbugs.patch b/removeMultilineSpotbugs.patch index 51763b5..e612855 100644 --- a/removeMultilineSpotbugs.patch +++ b/removeMultilineSpotbugs.patch @@ -36,4 +36,17 @@ class FileSelectorArrayRowTest { @BeforeAll static void setup() { +--- a/runtime-decompiler/src/main/java/org/jrd/backend/data/cli/utils/CompileArguments.java ++++ a/runtime-decompiler/src/main/java/org/jrd/backend/data/cli/utils/CompileArguments.java +@@ -77,10 +77,6 @@ + return new RuntimeCompilerConnector.JrdClassesProvider(localVmInfo, vmManager); + } + +- @SuppressFBWarnings( +- value = "NP_LOAD_OF_KNOWN_NULL_VALUE", +- justification = "Classpath is only used for FS VMs, in other cases getCp() does not get called" +- ) + /** + * Warning, possibly unused, rotten code. + */ diff --git a/sources b/sources index 2c65d53..2e91c7f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (java-runtime-decompiler-6.1.tar.gz) = 41bd87f0311d47819107fbd34173e4e1cebef71eb8651a337fb71a30947ffbb6bcaea6877508e0a02b0b2fcead7fe51497ed6251329a0254a8ee48220275e86f +SHA512 (java-runtime-decompiler-7.3.tar.gz) = dc45ee8fa53d3f3f6479f9d2d8978a714731d1cb333fe4e15321564bc049d6cde90e2e618d304df24bbcb6dec23cca6cb5373e867c8ec45212746b344e65a1e2 diff --git a/systemJasm.patch b/systemJasm.patch index b5099af..eff068f 100644 --- a/systemJasm.patch +++ b/systemJasm.patch @@ -6,9 +6,8 @@ - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JasmDecompilerWrapper.java", + "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JasmDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" -+ "file:/usr/share/java/openjdk-asmtools/asmtools-core.jar" +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/8.0.b02-ea/asmtools-8.0.b02-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools.jar" ], "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" } - diff --git a/systemJasm7.patch b/systemJasm7.patch new file mode 100644 index 0000000..5b4da96 --- /dev/null +++ b/systemJasm7.patch @@ -0,0 +1,13 @@ +--- runtime-decompiler/src/plugins/Jasm7DecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/Jasm7DecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jasm7", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/Jasm7DecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/Jasm7DecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools7/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } diff --git a/systemJasmG.patch b/systemJasmG.patch new file mode 100644 index 0000000..0171e99 --- /dev/null +++ b/systemJasmG.patch @@ -0,0 +1,13 @@ +--- runtime-decompiler/src/plugins/JasmGDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JasmGDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jasmG", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JasmGDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JasmGDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/8.0.b02-ea/asmtools-8.0.b02-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } diff --git a/systemJasmG7.patch b/systemJasmG7.patch new file mode 100644 index 0000000..f0f0e55 --- /dev/null +++ b/systemJasmG7.patch @@ -0,0 +1,13 @@ +--- runtime-decompiler/src/plugins/JasmG7DecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JasmG7DecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jasmG7", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JasmG7DecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JasmG7DecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools7/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } diff --git a/systemJcoder.patch b/systemJcoder.patch index bdbacc7..cf6ce68 100644 --- a/systemJcoder.patch +++ b/systemJcoder.patch @@ -6,8 +6,8 @@ - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JcoderDecompilerWrapper.java", + "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JcoderDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" -+ "file:/usr/share/java/openjdk-asmtools/asmtools-core.jar" +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/8.0.b02-ea/asmtools-8.0.b02-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools.jar" ], "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" } diff --git a/systemJcoder7.patch b/systemJcoder7.patch new file mode 100644 index 0000000..d39c0ce --- /dev/null +++ b/systemJcoder7.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/Jcoder7DecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/Jcoder7DecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jcoder7", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/Jcoder7DecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/Jcoder7DecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools7/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } + diff --git a/systemJcoderG.patch b/systemJcoderG.patch new file mode 100644 index 0000000..85d8a63 --- /dev/null +++ b/systemJcoderG.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/JcoderGDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JcoderGDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jcoderG", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JcoderGDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JcoderGDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/8.0.b02-ea/asmtools-8.0.b02-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools/asmtools.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } + diff --git a/systemJcoderG7.patch b/systemJcoderG7.patch new file mode 100644 index 0000000..832113b --- /dev/null +++ b/systemJcoderG7.patch @@ -0,0 +1,14 @@ +--- runtime-decompiler/src/plugins/JcoderG7DecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/JcoderG7DecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -1,8 +1,8 @@ + { + "Name": "jcoderG7", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/JcoderG7DecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/JcoderG7DecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/org/openjdk/asmtools/asmtools-core/7.0.b10-ea/asmtools-core-7.0.b10-ea.jar" ++ "file:/usr/share/java/openjdk-asmtools7/asmtools-core.jar" + ], + "DecompilerDownloadURL": "https://github.com/openjdk/asmtools" + } + diff --git a/systemProcyon.patch b/systemProcyon.patch index 342a998..4886e80 100644 --- a/systemProcyon.patch +++ b/systemProcyon.patch @@ -1,17 +1,20 @@ --- runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 +++ runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 -@@ -1,9 +1,10 @@ - { +@@ -2,10 +2,10 @@ "Name": "Procyon", - "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/ProcyonDecompilerWrapper.java", -+ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/ProcyonDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/ProcyonDecompilerWrapper.java", "DependencyURL": [ -- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-core/0.5.36/procyon-core-0.5.36.jar", -- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-compilertools/0.5.36/procyon-compilertools-0.5.36.jar" +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-core/1.0-SNAPSHOT/procyon-core-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-compilertools/1.0-SNAPSHOT/procyon-compilertools-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-decompiler/1.0-SNAPSHOT/procyon-decompiler-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/beust/jcommander/1.78/jcommander-1.78.jar" + "/usr/share/java/procyon/procyon-core.jar", + "/usr/share/java/procyon/procyon-compilertools.jar", -+ "/usr/share/java/procyon/procyon-decompiler.jar" ++ "/usr/share/java/procyon/procyon-decompiler.jar", ++ "/usr/share/java/beust-jcommander.jar" ], - "DecompilerDownloadURL": "https://bitbucket.org/mstrobel/procyon/downloads/" + "DecompilerDownloadURL": "https://github.com/mstrobel/procyon/git " } + diff --git a/systemProcyonAssembler.patch b/systemProcyonAssembler.patch new file mode 100644 index 0000000..d385b99 --- /dev/null +++ b/systemProcyonAssembler.patch @@ -0,0 +1,20 @@ +--- runtime-decompiler/src/plugins/ProcyonAssemblerDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100 ++++ runtime-decompiler/src/plugins/ProcyonAssemblerDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100 +@@ -2,10 +2,10 @@ + "Name": "Procyon-Assembler", +- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/ProcyonAssemblerDecompilerWrapper.java", ++ "WrapperURL": "file:/etc/java-runtime-decompiler/plugins/ProcyonAssemblerDecompilerWrapper.java", + "DependencyURL": [ +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-core/1.0-SNAPSHOT/procyon-core-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-compilertools/1.0-SNAPSHOT/procyon-compilertools-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/github/mstrobel/procyon-decompiler/1.0-SNAPSHOT/procyon-decompiler-1.0-SNAPSHOT.jar", +- "file://${HOME}/.m2/repository/com/beust/jcommander/1.78/jcommander-1.78.jar" ++ "/usr/share/java/procyon/procyon-core.jar", ++ "/usr/share/java/procyon/procyon-compilertools.jar", ++ "/usr/share/java/procyon/procyon-decompiler.jar", ++ "/usr/share/java/beust-jcommander.jar" + ], + "DecompilerDownloadURL": "https://github.com/mstrobel/procyon/git " + } + + From 23895a58dfadf8fbf06e8fcd53ad36fdc87e15fa Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 11 Jul 2023 10:33:14 +0200 Subject: [PATCH 12/16] added 2b99a244b592445962cdd15ca33f80449f9aa2ea.patch to fix compiler issue in jrd window --- ...a244b592445962cdd15ca33f80449f9aa2ea.patch | 60 +++++++++++++++++++ java-runtime-decompiler.spec | 7 ++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 2b99a244b592445962cdd15ca33f80449f9aa2ea.patch diff --git a/2b99a244b592445962cdd15ca33f80449f9aa2ea.patch b/2b99a244b592445962cdd15ca33f80449f9aa2ea.patch new file mode 100644 index 0000000..1b258f8 --- /dev/null +++ b/2b99a244b592445962cdd15ca33f80449f9aa2ea.patch @@ -0,0 +1,60 @@ +commit 2b99a244b592445962cdd15ca33f80449f9aa2ea +Author: Jiri +Date: Tue Jul 11 10:16:41 2023 +0200 + + isTreatAllTabsAsOneBatch returns false in jrd mode and is not shown + +diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/decompilerview/TextWithControls.java b/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/decompilerview/TextWithControls.java +index 3e87e6d..a8db71a 100644 +--- a/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/decompilerview/TextWithControls.java ++++ b/runtime-decompiler/src/main/java/org/jrd/frontend/frame/main/decompilerview/TextWithControls.java +@@ -574,18 +574,20 @@ public class TextWithControls extends JPanel + } + }); + advanced.add(setMethod); +- JCheckBox treatAllAsOne = new JCheckBox("Treat all tabs in this window as single batch"); +- Container parent = getParentWindow(); +- if (parent != null) { +- treatAllAsOne.addActionListener(new ActionListener() { +- @Override +- public void actionPerformed(ActionEvent actionEvent) { +- setTreatAllTabsAsOneBatch(treatAllAsOne.isSelected()); +- repaintMenu(menu); +- } +- }); +- treatAllAsOne.setSelected(isTreatAllTabsAsOneBatch()); +- advanced.add(treatAllAsOne); ++ if (getParentWindow()!=null) { ++ JCheckBox treatAllAsOne = new JCheckBox("Treat all tabs in this window as single batch"); ++ Container parent = getParentWindow(); ++ if (parent != null) { ++ treatAllAsOne.addActionListener(new ActionListener() { ++ @Override ++ public void actionPerformed(ActionEvent actionEvent) { ++ setTreatAllTabsAsOneBatch(treatAllAsOne.isSelected()); ++ repaintMenu(menu); ++ } ++ }); ++ treatAllAsOne.setSelected(isTreatAllTabsAsOneBatch()); ++ advanced.add(treatAllAsOne); ++ } + } + if (hasVm(classesAndMethodsProvider)) { + JCheckBox addToBoot = new JCheckBox( +@@ -908,10 +910,16 @@ public class TextWithControls extends JPanel + } + + private void setTreatAllTabsAsOneBatch(boolean selected) { ++ if (getParentWindow() == null) { ++ return ; ++ } + getParentWindow().setTreatAllTabsAsOneBatch(selected); + } + + private boolean isTreatAllTabsAsOneBatch() { ++ if (getParentWindow() == null) { ++ return false; ++ } + return getParentWindow().isTreatAllTabsAsOneBatch(); + } + diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 40262ac..cc1d020 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,7 +1,7 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler Version: 7.3 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz @@ -22,6 +22,7 @@ Patch61: systemJcoder7.patch Patch62: systemJcoderG.patch Patch63: systemJcoderG7.patch Patch7: removeMultilineSpotbugs.patch +Patch8: 2b99a244b592445962cdd15ca33f80449f9aa2ea.patch BuildArch: noarch ExclusiveArch: %{java_arches} noarch @@ -123,6 +124,7 @@ This package provides bindings and requirements to asmtools7 disassembler and as %patch62 -p0 %patch63 -p0 %patch7 -p1 +%patch8 -p1 %build pushd runtime-decompiler @@ -228,6 +230,9 @@ rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/plugins/JdDecompilerWrapper.json %license LICENSE %changelog +* Tue Jul 11 2023 Fedora Release Engineering - 7.3-2 +- added 2b99a244b592445962cdd15ca33f80449f9aa2ea.patch to fix compiler issue in jrd window + * Fri Jun 30 2023 Fedora Release Engineering - 7.3-1 - moved to 7.3 - https://github.com/pmikova/java-runtime-decompiler/releases/tag/java-runtime-decompiler-7.3 From 317f241d3377321f8d8c5d3e54661782bc3d7e0a Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 12 Jul 2023 10:39:58 +0200 Subject: [PATCH 13/16] Removed maven clean plugin. Missing on epel9 --- java-runtime-decompiler.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index cc1d020..027c1e9 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -38,7 +38,7 @@ BuildRequires: maven-surefire-provider-junit #BuildRequires: maven-surefire-provider-junit5 BuildRequires: maven-surefire BuildRequires: maven-surefire-plugin -BuildRequires: maven-clean-plugin +#BuildRequires: maven-clean-plugin BuildRequires: java-11-devel BuildRequires: google-gson BuildRequires: desktop-file-utils @@ -133,6 +133,7 @@ popd %pom_remove_plugin :spotbugs-maven-plugin %pom_remove_plugin :maven-checkstyle-plugin %pom_remove_plugin :formatter-maven-plugin +%pom_remove_plugin :clean-maven-plugin %pom_remove_dep :spotbugs-annotations a=`find | grep ".*\.java$"` for x in $a ; do From 8938faf314a0b347f1ab1c204315e9ea277ebc4b Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Wed, 12 Jul 2023 17:00:30 +0200 Subject: [PATCH 14/16] Being explicit on what jdk to use for man pages generation --- java-runtime-decompiler.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 027c1e9..d48ac53 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -146,7 +146,7 @@ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk #why? xmvn --version %mvn_build -f --xmvn-javadoc -- -Plegacy CPLC=/usr/share/java/classpathless-compiler -java -cp $CPLC/classpathless-compiler.jar:$CPLC/classpathless-compiler-api.jar:$CPLC/classpathless-compiler-util.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.cli.Help > %{name}.1 +$JAVA_HOME/bin/java -cp $CPLC/classpathless-compiler.jar:$CPLC/classpathless-compiler-api.jar:$CPLC/classpathless-compiler-util.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.cli.Help > %{name}.1 %install %mvn_install From dfd4fed7d6a2172ca1422473bda52eb49eada88f Mon Sep 17 00:00:00 2001 From: Jiri Date: Thu, 13 Jul 2023 17:29:57 +0200 Subject: [PATCH 15/16] Removed removal of clean plugin, it is not used --- java-runtime-decompiler.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index d48ac53..70f2e07 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -38,7 +38,6 @@ BuildRequires: maven-surefire-provider-junit #BuildRequires: maven-surefire-provider-junit5 BuildRequires: maven-surefire BuildRequires: maven-surefire-plugin -#BuildRequires: maven-clean-plugin BuildRequires: java-11-devel BuildRequires: google-gson BuildRequires: desktop-file-utils @@ -133,7 +132,6 @@ popd %pom_remove_plugin :spotbugs-maven-plugin %pom_remove_plugin :maven-checkstyle-plugin %pom_remove_plugin :formatter-maven-plugin -%pom_remove_plugin :clean-maven-plugin %pom_remove_dep :spotbugs-annotations a=`find | grep ".*\.java$"` for x in $a ; do From 02421b77a26c24b72ba274b272e127d3ad37d281 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Mon, 17 Jul 2023 19:20:35 +0200 Subject: [PATCH 16/16] strictly needing jdk17 unless user says differently --- java-runtime-decompiler | 6 ++++++ java-runtime-decompiler.spec | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/java-runtime-decompiler b/java-runtime-decompiler index df6ccc7..33ae9dd 100644 --- a/java-runtime-decompiler +++ b/java-runtime-decompiler @@ -2,6 +2,12 @@ # java runtime decompiler launch script +# unless java_home is set, select jdk17 +# this must be before sourcing java-functions +if [ "x$JAVA_HOME" == "x" ] ; then + export JAVA_HOME=/usr/lib/jvm/jre-17-openjdk +fi + # JPackage Project # Source functions library diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 70f2e07..d02855a 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -1,7 +1,7 @@ Summary: Application for extraction and decompilation of JVM byte code Name: java-runtime-decompiler Version: 7.3 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3 URL: https://github.com/pmikova/java-runtime-decompiler Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz @@ -45,10 +45,10 @@ BuildRequires: classpathless-compiler Requires: google-gson Requires: byteman Requires: rsyntaxtextarea -Requires: java-11-openjdk-headless +Requires: java-17-openjdk-headless Requires: classpathless-compiler Requires: java-diff-utils -Recommends: java-11-openjdk +Recommends: java-17-openjdk Recommends: %{name}-fernflower-plugin Recommends: %{name}-procyon-plugin Recommends: %{name}-cfr-plugin @@ -229,6 +229,9 @@ rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/plugins/JdDecompilerWrapper.json %license LICENSE %changelog +* Tue Jul 11 2023 Fedora Release Engineering - 7.3-3 +- strictly needing jdk17 unless user says differently + * Tue Jul 11 2023 Fedora Release Engineering - 7.3-2 - added 2b99a244b592445962cdd15ca33f80449f9aa2ea.patch to fix compiler issue in jrd window