From 3242356c80f06e101ddcb1b70025a551c050e92f Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 27 Aug 2019 14:56:45 +0100 Subject: [PATCH] Remove unused throws declarations --- .../openrs2/bundler/transform/HostCheckTransformer.java | 7 +++---- .../openrs2/bundler/transform/RightClickTransformer.java | 7 +++---- .../java/dev/openrs2/deob/analysis/IntInterpreter.java | 2 +- .../java/dev/openrs2/deob/remap/ClassNamePrefixer.java | 3 +-- .../dev/openrs2/deob/transform/DummyLocalTransformer.java | 7 +++---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.java b/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.java index fb413dd0b1..e0fc32863c 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.java +++ b/bundler/src/main/java/dev/openrs2/bundler/transform/HostCheckTransformer.java @@ -9,7 +9,6 @@ import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.InsnNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.analysis.AnalyzerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,12 +20,12 @@ public final class HostCheckTransformer extends Transformer { private int hostChecks; @Override - protected void preTransform(ClassPath classPath) throws AnalyzerException { + protected void preTransform(ClassPath classPath) { hostChecks = 0; } @Override - protected boolean transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException { + protected boolean transformCode(ClassNode clazz, MethodNode method) { if (Type.getReturnType(method.desc).getSort() != Type.BOOLEAN) { return false; } @@ -84,7 +83,7 @@ public final class HostCheckTransformer extends Transformer { } @Override - protected void postTransform(ClassPath classPath) throws AnalyzerException { + protected void postTransform(ClassPath classPath) { logger.info("Removed {} host checks", hostChecks); } } diff --git a/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.java b/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.java index cb4e387ca5..8550471660 100644 --- a/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.java +++ b/bundler/src/main/java/dev/openrs2/bundler/transform/RightClickTransformer.java @@ -9,7 +9,6 @@ import org.objectweb.asm.tree.InsnList; import org.objectweb.asm.tree.InsnNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodNode; -import org.objectweb.asm.tree.analysis.AnalyzerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,12 +18,12 @@ public final class RightClickTransformer extends Transformer { private int metaDownCalls; @Override - protected void preTransform(ClassPath classPath) throws AnalyzerException { + protected void preTransform(ClassPath classPath) { metaDownCalls = 0; } @Override - protected boolean transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException { + protected boolean transformCode(ClassNode clazz, MethodNode method) { for (var it = method.instructions.iterator(); it.hasNext(); ) { var insn = it.next(); if (insn.getOpcode() != Opcodes.INVOKEVIRTUAL) { @@ -59,7 +58,7 @@ public final class RightClickTransformer extends Transformer { } @Override - protected void postTransform(ClassPath classPath) throws AnalyzerException { + protected void postTransform(ClassPath classPath) { logger.info("Replaced {} isMetaDown calls with getModifiersEx", metaDownCalls); } } diff --git a/deob/src/main/java/dev/openrs2/deob/analysis/IntInterpreter.java b/deob/src/main/java/dev/openrs2/deob/analysis/IntInterpreter.java index a03d53b0d2..5d234d65c7 100644 --- a/deob/src/main/java/dev/openrs2/deob/analysis/IntInterpreter.java +++ b/deob/src/main/java/dev/openrs2/deob/analysis/IntInterpreter.java @@ -79,7 +79,7 @@ public final class IntInterpreter extends Interpreter { } @Override - public IntValue copyOperation(AbstractInsnNode insn, IntValue value) throws AnalyzerException { + public IntValue copyOperation(AbstractInsnNode insn, IntValue value) { return value; } diff --git a/deob/src/main/java/dev/openrs2/deob/remap/ClassNamePrefixer.java b/deob/src/main/java/dev/openrs2/deob/remap/ClassNamePrefixer.java index 6076c25423..2de094937d 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/ClassNamePrefixer.java +++ b/deob/src/main/java/dev/openrs2/deob/remap/ClassNamePrefixer.java @@ -8,10 +8,9 @@ import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.ClassRemapper; import org.objectweb.asm.commons.SimpleRemapper; import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.analysis.AnalyzerException; public final class ClassNamePrefixer { - public static void addPrefix(Library library, String prefix) throws AnalyzerException { + public static void addPrefix(Library library, String prefix) { var mapping = new HashMap(); for (var clazz : library) { if (TypedRemapper.EXCLUDED_CLASSES.contains(clazz.name)) { diff --git a/deob/src/main/java/dev/openrs2/deob/transform/DummyLocalTransformer.java b/deob/src/main/java/dev/openrs2/deob/transform/DummyLocalTransformer.java index 76030d674d..7f5b1d0c4d 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/DummyLocalTransformer.java +++ b/deob/src/main/java/dev/openrs2/deob/transform/DummyLocalTransformer.java @@ -8,7 +8,6 @@ import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.VarInsnNode; -import org.objectweb.asm.tree.analysis.AnalyzerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,12 +33,12 @@ public final class DummyLocalTransformer extends Transformer { private int localsRemoved; @Override - protected void preTransform(ClassPath classPath) throws AnalyzerException { + protected void preTransform(ClassPath classPath) { localsRemoved = 0; } @Override - protected boolean transformCode(ClassNode clazz, MethodNode method) throws AnalyzerException { + protected boolean transformCode(ClassNode clazz, MethodNode method) { /* * XXX(gpe): this is primitive (ideally we'd do a proper data flow * analysis, but we'd need to do it in reverse and ASM only supports @@ -77,7 +76,7 @@ public final class DummyLocalTransformer extends Transformer { } @Override - protected void postTransform(ClassPath classPath) throws AnalyzerException { + protected void postTransform(ClassPath classPath) { logger.info("Removed {} dummy local variables", localsRemoved); } }