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"