Skip to content

Commit

Permalink
Don't remove final modifier
Browse files Browse the repository at this point in the history
It wasn't needed, and was causing problems with Java 12+
  • Loading branch information
ThisTestUser committed Jul 29, 2020
1 parent 0c3641c commit deb003e
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public static void set(Object instance, Field field, Object value) {
public static <T> 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);
}
Expand All @@ -101,10 +97,6 @@ public static <T> T getFieldO(Object instance, String name) throws Exception {
public static <T> 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);
}
Expand All @@ -120,10 +112,6 @@ public static <T> 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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit deb003e

Please sign in to comment.