From deb003e70d94c48db377deb5ec73132e48b6e36f Mon Sep 17 00:00:00 2001 From: ThisTestUser Date: Wed, 29 Jul 2020 15:39:30 -0400 Subject: [PATCH] Don't remove final modifier It wasn't needed, and was causing problems with Java 12+ --- .../deobfuscator/ui/util/Reflect.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java b/src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java index a9a01a7..e0f7676 100644 --- a/src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java +++ b/src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java @@ -82,10 +82,6 @@ public static void set(Object instance, Field field, Object value) { public static T getFieldO(Object instance, String name) throws Exception { Field f = instance.getClass().getDeclaredField(name); f.setAccessible(true); - // hack access - Field acc = Field.class.getDeclaredField("modifiers"); - acc.setAccessible(true); - acc.setInt(f, f.getModifiers() & ~Modifier.FINAL); // get return (T) f.get(instance); } @@ -101,10 +97,6 @@ public static T getFieldO(Object instance, String name) throws Exception { public static T getFieldS(Class clazz, String name) throws Exception { Field f = clazz.getDeclaredField(name); f.setAccessible(true); - // hack access - Field acc = Field.class.getDeclaredField("modifiers"); - acc.setAccessible(true); - acc.setInt(f, f.getModifiers() & ~Modifier.FINAL); // get return (T) f.get(null); } @@ -120,10 +112,6 @@ public static T getFieldS(Class clazz, String name) throws Exception { public static void setFieldO(Object instance, String name, Object value) throws Exception { Field f = instance.getClass().getDeclaredField(name); f.setAccessible(true); - // hack access - Field acc = Field.class.getDeclaredField("modifiers"); - acc.setAccessible(true); - acc.setInt(f, f.getModifiers() & ~Modifier.FINAL); // set f.set(instance, value); } @@ -139,10 +127,6 @@ public static void setFieldO(Object instance, String name, Object value) throws public static void setFieldS(Class clazz, String name, Object value) throws Exception { Field f = clazz.getDeclaredField(name); f.setAccessible(true); - // hack access - Field acc = Field.class.getDeclaredField("modifiers"); - acc.setAccessible(true); - acc.setInt(f, f.getModifiers() & ~Modifier.FINAL); // set f.set(null, value); }