Remove redundant final modifiers

bzip2
Graham 5 years ago
parent 7585d96b37
commit 6520c15795
  1. 4
      deob/src/main/java/dev/openrs2/deob/Deobfuscator.java
  2. 39
      deob/src/main/java/dev/openrs2/deob/transform/AccessTransformer.java

@ -14,6 +14,7 @@ import dev.openrs2.bundler.transform.HostCheckTransformer;
import dev.openrs2.bundler.transform.MacResizeTransformer; import dev.openrs2.bundler.transform.MacResizeTransformer;
import dev.openrs2.bundler.transform.RightClickTransformer; import dev.openrs2.bundler.transform.RightClickTransformer;
import dev.openrs2.deob.remap.PrefixRemapper; import dev.openrs2.deob.remap.PrefixRemapper;
import dev.openrs2.deob.transform.AccessTransformer;
import dev.openrs2.deob.transform.BitShiftTransformer; import dev.openrs2.deob.transform.BitShiftTransformer;
import dev.openrs2.deob.transform.BitwiseOpTransformer; import dev.openrs2.deob.transform.BitwiseOpTransformer;
import dev.openrs2.deob.transform.CanvasTransformer; import dev.openrs2.deob.transform.CanvasTransformer;
@ -49,7 +50,8 @@ public final class Deobfuscator {
new RemapTransformer(), new RemapTransformer(),
new DummyArgTransformer(), new DummyArgTransformer(),
new DummyLocalTransformer(), new DummyLocalTransformer(),
new UnusedArgTransformer() new UnusedArgTransformer(),
new AccessTransformer()
); );
public static void main(String[] args) throws IOException, AnalyzerException { public static void main(String[] args) throws IOException, AnalyzerException {

@ -0,0 +1,39 @@
package dev.openrs2.deob.transform;
import dev.openrs2.asm.classpath.ClassPath;
import dev.openrs2.asm.classpath.Library;
import dev.openrs2.asm.transform.Transformer;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class AccessTransformer extends Transformer {
private static final Logger logger = LoggerFactory.getLogger(AccessTransformer.class);
private int redundantFinals;
@Override
protected void preTransform(ClassPath classPath) {
redundantFinals = 0;
}
@Override
protected boolean preTransformMethod(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) {
if ((method.access & Opcodes.ACC_FINAL) == 0) {
return false;
}
if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC)) != 0) {
method.access &= ~Opcodes.ACC_FINAL;
redundantFinals++;
}
return false;
}
@Override
protected void postTransform(ClassPath classPath) {
logger.info("Removed {} redundant final modifiers", redundantFinals);
}
}
Loading…
Cancel
Save