From bfa609e149f7641bc628b3d5a926c795caed96c1 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 1 Dec 2021 22:55:21 +0100 Subject: [PATCH] Removed spotbugs in code --- java-runtime-decompiler.spec | 8 ++++++- removeMultilineSpotbugs.patch | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 removeMultilineSpotbugs.patch diff --git a/java-runtime-decompiler.spec b/java-runtime-decompiler.spec index 34aee33..0aaba92 100644 --- a/java-runtime-decompiler.spec +++ b/java-runtime-decompiler.spec @@ -13,7 +13,7 @@ Patch3: rsyntaxVersion.patch Patch4: systemCfr.patch Patch5: systemJasm.patch Patch6: systemJcoder.patch - +Patch7: removeMultilineSpotbugs.patch BuildArch: noarch BuildRequires: maven-local @@ -59,6 +59,7 @@ This package contains the API documentation for %{name}. %patch4 -p0 %patch5 -p0 %patch6 -p0 +%patch7 -p1 %build pushd runtime-decompiler @@ -68,6 +69,11 @@ popd %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 %mvn_build --xmvn-javadoc -- -Plegacy java -cp /usr/share/java/classpathless-compiler/classpathless-compiler.jar:runtime-decompiler/target/runtime-decompiler-%{version}.jar org.jrd.backend.data.Help > %{name}.1 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() { +