diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt b/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt
index 08d639c302..2c20b65d7e 100644
--- a/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt
+++ b/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt
@@ -71,6 +71,23 @@ abstract class ClassMetadata {
return false
}
+ fun resolveField(member: MemberDesc): ClassMetadata? {
+ // see https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-5.html#jvms-5.4.3.2
+
+ if (fields.contains(member)) {
+ return this
+ }
+
+ for (superInterface in superInterfaces) {
+ val field = superInterface.resolveField(member)
+ if (field != null) {
+ return field
+ }
+ }
+
+ return superClass?.resolveField(member)
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ClassMetadata) return false
diff --git a/deob/src/main/java/dev/openrs2/deob/DeobfuscatorModule.kt b/deob/src/main/java/dev/openrs2/deob/DeobfuscatorModule.kt
index f1896c8f7a..454bce22d2 100644
--- a/deob/src/main/java/dev/openrs2/deob/DeobfuscatorModule.kt
+++ b/deob/src/main/java/dev/openrs2/deob/DeobfuscatorModule.kt
@@ -18,6 +18,7 @@ import dev.openrs2.deob.transform.EmptyClassTransformer
import dev.openrs2.deob.transform.ExceptionTracingTransformer
import dev.openrs2.deob.transform.FernflowerExceptionTransformer
import dev.openrs2.deob.transform.FieldOrderTransformer
+import dev.openrs2.deob.transform.FinalFieldTransformer
import dev.openrs2.deob.transform.FinalTransformer
import dev.openrs2.deob.transform.InvokeSpecialTransformer
import dev.openrs2.deob.transform.MethodOrderTransformer
@@ -69,6 +70,7 @@ object DeobfuscatorModule : AbstractModule() {
binder.addBinding().to(MethodOrderTransformer::class.java)
binder.addBinding().to(VisibilityTransformer::class.java)
binder.addBinding().to(FinalTransformer::class.java)
+ binder.addBinding().to(FinalFieldTransformer::class.java)
binder.addBinding().to(OverrideTransformer::class.java)
binder.addBinding().to(RedundantGotoTransformer::class.java)
binder.addBinding().to(OriginalPcRestoreTransformer::class.java)
diff --git a/deob/src/main/java/dev/openrs2/deob/analysis/FieldWriteAnalyzer.kt b/deob/src/main/java/dev/openrs2/deob/analysis/FieldWriteAnalyzer.kt
new file mode 100644
index 0000000000..d958cdaae0
--- /dev/null
+++ b/deob/src/main/java/dev/openrs2/deob/analysis/FieldWriteAnalyzer.kt
@@ -0,0 +1,78 @@
+package dev.openrs2.deob.analysis
+
+import dev.openrs2.asm.MemberDesc
+import dev.openrs2.asm.classpath.ClassPath
+import org.objectweb.asm.Opcodes
+import org.objectweb.asm.tree.AbstractInsnNode
+import org.objectweb.asm.tree.FieldInsnNode
+import org.objectweb.asm.tree.MethodNode
+import org.objectweb.asm.tree.analysis.Frame
+
+class FieldWriteAnalyzer(
+ private val owner: String,
+ private val method: MethodNode,
+ private val classPath: ClassPath,
+ private val frames: Array>
+) : DataFlowAnalyzer