Skip to content

Commit deb003e

Browse files
committed
Don't remove final modifier
It wasn't needed, and was causing problems with Java 12+
1 parent 0c3641c commit deb003e

File tree

1 file changed

+0
-16
lines changed
  • src/java/com/javadeobfuscator/deobfuscator/ui/util

1 file changed

+0
-16
lines changed

src/java/com/javadeobfuscator/deobfuscator/ui/util/Reflect.java

-16
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ public static void set(Object instance, Field field, Object value) {
8282
public static <T> T getFieldO(Object instance, String name) throws Exception {
8383
Field f = instance.getClass().getDeclaredField(name);
8484
f.setAccessible(true);
85-
// hack access
86-
Field acc = Field.class.getDeclaredField("modifiers");
87-
acc.setAccessible(true);
88-
acc.setInt(f, f.getModifiers() & ~Modifier.FINAL);
8985
// get
9086
return (T) f.get(instance);
9187
}
@@ -101,10 +97,6 @@ public static <T> T getFieldO(Object instance, String name) throws Exception {
10197
public static <T> T getFieldS(Class<?> clazz, String name) throws Exception {
10298
Field f = clazz.getDeclaredField(name);
10399
f.setAccessible(true);
104-
// hack access
105-
Field acc = Field.class.getDeclaredField("modifiers");
106-
acc.setAccessible(true);
107-
acc.setInt(f, f.getModifiers() & ~Modifier.FINAL);
108100
// get
109101
return (T) f.get(null);
110102
}
@@ -120,10 +112,6 @@ public static <T> T getFieldS(Class<?> clazz, String name) throws Exception {
120112
public static void setFieldO(Object instance, String name, Object value) throws Exception {
121113
Field f = instance.getClass().getDeclaredField(name);
122114
f.setAccessible(true);
123-
// hack access
124-
Field acc = Field.class.getDeclaredField("modifiers");
125-
acc.setAccessible(true);
126-
acc.setInt(f, f.getModifiers() & ~Modifier.FINAL);
127115
// set
128116
f.set(instance, value);
129117
}
@@ -139,10 +127,6 @@ public static void setFieldO(Object instance, String name, Object value) throws
139127
public static void setFieldS(Class<?> clazz, String name, Object value) throws Exception {
140128
Field f = clazz.getDeclaredField(name);
141129
f.setAccessible(true);
142-
// hack access
143-
Field acc = Field.class.getDeclaredField("modifiers");
144-
acc.setAccessible(true);
145-
acc.setInt(f, f.getModifiers() & ~Modifier.FINAL);
146130
// set
147131
f.set(null, value);
148132
}

0 commit comments

Comments
 (0)