From 327a6f0e3f66d0388dfa291a0b779b847e81b45b Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 6 Jun 2020 16:34:39 +0100 Subject: [PATCH] Allow final modifier to replace volatile modifier volatile is pointless if a field is final - even on arrays/objects, as it only applies to the reference, not the contents of the target. Signed-off-by: Graham --- .../openrs2/deob/transform/FinalFieldTransformer.kt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/FinalFieldTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/FinalFieldTransformer.kt index f2cae3fec7..dd901c0607 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/FinalFieldTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/FinalFieldTransformer.kt @@ -14,7 +14,6 @@ import dev.openrs2.util.collect.DisjointSet import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.FieldInsnNode -import org.objectweb.asm.tree.FieldNode import org.objectweb.asm.tree.MethodInsnNode import org.objectweb.asm.tree.MethodNode import org.objectweb.asm.tree.analysis.Analyzer @@ -119,15 +118,6 @@ class FinalFieldTransformer : Transformer() { return false } - override fun transformField(classPath: ClassPath, library: Library, clazz: ClassNode, field: FieldNode): Boolean { - if ((field.access and Opcodes.ACC_VOLATILE) != 0) { - val partition = inheritedFieldSets[MemberRef(clazz, field)]!! - nonFinalFields += partition - } - - return false - } - override fun postTransform(classPath: ClassPath) { var fieldsChanged = 0 @@ -142,7 +132,7 @@ class FinalFieldTransformer : Transformer() { if (nonFinalFields.contains(partition)) { field.access = field.access and Opcodes.ACC_FINAL.inv() } else { - field.access = field.access or Opcodes.ACC_FINAL + field.access = (field.access or Opcodes.ACC_FINAL) and Opcodes.ACC_VOLATILE.inv() } if (field.access != access) {