Skip to content

Commit 2dcfabf

Browse files
committedFeb 8, 2025··
dont remap if method overrides library method, include java runtime in vineflower
1 parent 975a781 commit 2dcfabf

File tree

19 files changed

+129
-59
lines changed

19 files changed

+129
-59
lines changed
 

‎deobfuscator-api/src/main/java/uwu/narumi/deobfuscator/api/asm/FieldRef.java

+5
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ public static FieldRef of(ClassNode classNode, FieldNode fieldNode) {
1717
public static FieldRef of(FieldInsnNode fieldInsn) {
1818
return new FieldRef(fieldInsn.owner, fieldInsn.name, fieldInsn.desc);
1919
}
20+
21+
@Override
22+
public String toString() {
23+
return owner + "." + name + desc;
24+
}
2025
}

‎deobfuscator-api/src/main/java/uwu/narumi/deobfuscator/api/asm/MethodRef.java

+5
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ public static MethodRef of(ClassNode classNode, MethodNode methodNode) {
1717
public static MethodRef of(MethodInsnNode methodInsn) {
1818
return new MethodRef(methodInsn.owner, methodInsn.name, methodInsn.desc);
1919
}
20+
21+
@Override
22+
public String toString() {
23+
return owner + "." + name + desc;
24+
}
2025
}

‎deobfuscator-api/src/main/java/uwu/narumi/deobfuscator/api/inheritance/InheritanceGraph.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import uwu.narumi.deobfuscator.api.classpath.ClassProvider;
1010
import uwu.narumi.deobfuscator.api.classpath.CombinedClassProvider;
1111
import uwu.narumi.deobfuscator.api.classpath.JvmClassProvider;
12+
import uwu.narumi.deobfuscator.api.context.Context;
1213

1314
import java.util.*;
1415
import java.util.concurrent.ConcurrentHashMap;
@@ -33,12 +34,14 @@ public class InheritanceGraph {
3334
private final Set<String> stubs = ConcurrentHashMap.newKeySet();
3435
private final Function<String, InheritanceVertex> vertexProvider = createVertexProvider();
3536
private final ClassProvider classProvider;
37+
private final ClassProvider librariesClassProvider;
3638

3739
/**
3840
* Create an inheritance graph.
3941
*/
40-
public InheritanceGraph(@NotNull ClassProvider classProvider) {
41-
this.classProvider = new CombinedClassProvider(classProvider, JvmClassProvider.INSTANCE);
42+
public InheritanceGraph(@NotNull Context context) {
43+
this.librariesClassProvider = new CombinedClassProvider(context.getLibraries(), JvmClassProvider.INSTANCE);
44+
this.classProvider = new CombinedClassProvider(context, this.librariesClassProvider);
4245

4346
// Populate downwards (parent --> child) lookup
4447
refreshChildLookup();
@@ -310,13 +313,13 @@ private Function<String, InheritanceVertex> createVertexProvider() {
310313
//ResourcePathNode resourcePath = result.getPathOfType(WorkspaceResource.class);
311314
//boolean isPrimary = resourcePath != null && resourcePath.isPrimary();
312315
//ClassInfo info = result.getValue();
313-
return new InheritanceVertex(result, this::getVertex, this::getDirectChildren);
316+
return new InheritanceVertex(result, this::getVertex, this::getDirectChildren, this.librariesClassProvider.getClass(name) == null);
314317
};
315318
}
316319

317320
private static class InheritanceStubVertex extends InheritanceVertex {
318321
private InheritanceStubVertex() {
319-
super(new ClassNode(), in -> null, in -> null);
322+
super(new ClassNode(), in -> null, in -> null, false);
320323
}
321324

322325
@Override

‎deobfuscator-api/src/main/java/uwu/narumi/deobfuscator/api/inheritance/InheritanceVertex.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public class InheritanceVertex {
2121
private final Function<String, InheritanceVertex> lookup;
2222
private final Function<String, Collection<String>> childrenLookup;
23-
//private final boolean isPrimary;
23+
private final boolean isPrimary;
2424
private volatile Set<InheritanceVertex> parents;
2525
private volatile Set<InheritanceVertex> children;
2626
private ClassNode value;
@@ -35,11 +35,12 @@ public class InheritanceVertex {
3535
*/
3636
public InheritanceVertex(@NotNull ClassNode value,
3737
@NotNull Function<String, InheritanceVertex> lookup,
38-
@NotNull Function<String, Collection<String>> childrenLookup) {
38+
@NotNull Function<String, Collection<String>> childrenLookup,
39+
boolean isPrimary) {
3940
this.value = value;
4041
this.lookup = lookup;
4142
this.childrenLookup = childrenLookup;
42-
//this.isPrimary = isPrimary;
43+
this.isPrimary = isPrimary;
4344
}
4445

4546
/**
@@ -138,12 +139,10 @@ public boolean hasMethodInSelfOrChildren(@NotNull String name, @NotNull String d
138139

139140
/**
140141
* @return {@code true} if the class represented by this vertex is a library class.
141-
* This means a class that does not belong to the primary {@link WorkspaceResource}
142-
* of a {@link Workspace}.
143142
*/
144-
/*public boolean isLibraryVertex() {
143+
public boolean isLibraryVertex() {
145144
return !isPrimary;
146-
}*/
145+
}
147146

148147
/**
149148
* @return {@code true} when the current vertex represents {@link Object}.
@@ -177,7 +176,7 @@ public boolean isModule() {
177176
* @return {@code true} if method is an extension of an outside class's methods and thus should not be renamed.
178177
* {@code false} if the method is safe to rename.
179178
*/
180-
/*public boolean isLibraryMethod(@NotNull String name, @NotNull String desc) {
179+
public boolean isLibraryMethod(@NotNull String name, @NotNull String desc) {
181180
// Check against this definition
182181
if (!isPrimary && hasMethod(name, desc))
183182
return true;
@@ -190,7 +189,7 @@ public boolean isModule() {
190189

191190
// No library definition found, so its safe to rename.
192191
return false;
193-
}*/
192+
}
194193

195194
/**
196195
* @param vertex

‎deobfuscator-impl/src/main/java/uwu/narumi/deobfuscator/Deobfuscator.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ private void saveToJar() {
187187
* @param saver a consumer that accepts a path and data to save
188188
*/
189189
private void save(BiConsumer<String, byte[]> saver) {
190-
InheritanceGraph inheritanceGraph = new InheritanceGraph(
191-
new CombinedClassProvider(this.context, this.context.getLibraries())
192-
);
190+
InheritanceGraph inheritanceGraph = new InheritanceGraph(this.context);
193191

194192
// Save classes
195193
context.getClassesMap().forEach((ignored, classWrapper) -> {

‎deobfuscator-impl/src/test/java/uwu/narumi/deobfuscator/base/TestDeobfuscationBase.java

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ private void assertOutput(@Nullable IContextSource contextSource, @Nullable Path
155155

156156
Decompiler.Builder decompilerBuilder = Decompiler.builder()
157157
.option(IFernflowerPreferences.INDENT_STRING, " ")
158+
.option(IFernflowerPreferences.INCLUDE_JAVA_RUNTIME, true)
158159
.output(assertingResultSaver); // Assert output
159160

160161
// Add sources

‎deobfuscator-transformers/src/main/java/uwu/narumi/deobfuscator/core/other/impl/universal/RemapperTransformer.java

+36-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
import uwu.narumi.deobfuscator.api.asm.FieldRef;
77
import uwu.narumi.deobfuscator.api.asm.MethodRef;
88
import uwu.narumi.deobfuscator.api.asm.remapper.NamesRemapper;
9-
import uwu.narumi.deobfuscator.api.classpath.CombinedClassProvider;
109
import uwu.narumi.deobfuscator.api.context.DeobfuscatorOptions;
1110
import uwu.narumi.deobfuscator.api.inheritance.InheritanceGraph;
1211
import uwu.narumi.deobfuscator.api.inheritance.InheritanceVertex;
1312
import uwu.narumi.deobfuscator.api.transformer.Transformer;
1413

14+
import java.io.IOException;
15+
import java.nio.file.Files;
16+
import java.nio.file.Path;
1517
import java.util.ArrayList;
1618
import java.util.Comparator;
1719
import java.util.List;
@@ -20,7 +22,7 @@
2022
import java.util.function.Predicate;
2123

2224
/**
23-
* Remaps class, method and field names. Useful to remap scrambled names to something more readable.
25+
* Remaps class, method, and field names. Useful to remap scrambled names to something more readable.
2426
* <p>
2527
* WARNING: If class overrides a method from a library's class and the library is not loaded {@link DeobfuscatorOptions#libraries()}
2628
* then the method will be remapped and will no longer override the library method. You must load the library to prevent this.
@@ -44,9 +46,7 @@ public RemapperTransformer(Predicate<String> classPredicate, Predicate<String> m
4446
protected void transform() throws Exception {
4547
NamesRemapper remapper = new NamesRemapper();
4648

47-
InheritanceGraph inheritanceGraph = new InheritanceGraph(
48-
new CombinedClassProvider(context(), context().getLibraries())
49-
);
49+
InheritanceGraph inheritanceGraph = new InheritanceGraph(context());
5050

5151
AtomicInteger classCounter = new AtomicInteger(0);
5252
AtomicInteger methodCounter = new AtomicInteger(0);
@@ -63,8 +63,9 @@ protected void transform() throws Exception {
6363
remapper.classMappings.put(classWrapper.name(), "class_" + classCounter.getAndIncrement());
6464
}
6565

66+
InheritanceVertex vertex = inheritanceGraph.getVertex(classWrapper.name());
6667
// Parents and children combined
67-
Set<InheritanceVertex> directVertices = inheritanceGraph.getVertex(classWrapper.name()).getAllDirectVertices();
68+
Set<InheritanceVertex> directVertices = vertex.getAllDirectVertices();
6869

6970
// Methods
7071
classWrapper.methods().forEach(methodNode -> {
@@ -78,14 +79,19 @@ protected void transform() throws Exception {
7879
// Test
7980
if (!this.methodPredicate.test(methodNode.name)) return;
8081

82+
if (vertex.isLibraryMethod(methodNode.name, methodNode.desc)) {
83+
// It is a library method, don't remap
84+
return;
85+
}
86+
8187
String newName = "method_" + methodCounter.getAndIncrement();
8288

8389
// Map current method
8490
remapper.methodMappings.put(methodRef, newName);
8591

8692
// Map the same method in inheritance graph
87-
for (InheritanceVertex vertex : directVertices) {
88-
remapper.methodMappings.put(MethodRef.of(vertex.getValue(), methodNode), newName);
93+
for (InheritanceVertex directVertex : directVertices) {
94+
remapper.methodMappings.put(MethodRef.of(directVertex.getValue(), methodNode), newName);
8995
}
9096
});
9197

@@ -103,6 +109,8 @@ protected void transform() throws Exception {
103109
});
104110
});
105111

112+
//saveMappings(remapper);
113+
106114
// Remap
107115
new ArrayList<>(context().classes()).forEach(classWrapper -> {
108116
ClassNode newNode = new ClassNode();
@@ -122,4 +130,24 @@ protected void transform() throws Exception {
122130
markChange();
123131
});
124132
}
133+
134+
private void saveMappings(NamesRemapper remapper) throws IOException {
135+
StringBuilder mappings = new StringBuilder();
136+
mappings.append("Class mappings:\n");
137+
for (var entry : remapper.classMappings.entrySet()) {
138+
mappings.append(entry.getKey()).append(" -> ").append(entry.getValue()).append("\n");
139+
}
140+
mappings.append("\n");
141+
mappings.append("Method mappings\n");
142+
for (var entry : remapper.methodMappings.entrySet()) {
143+
mappings.append(entry.getKey()).append(" -> ").append(entry.getValue()).append("\n");
144+
}
145+
mappings.append("\n");
146+
mappings.append("Field mappings\n");
147+
for (var entry : remapper.fieldMappings.entrySet()) {
148+
mappings.append(entry.getKey()).append(" -> ").append(entry.getValue()).append("\n");
149+
}
150+
151+
Files.writeString(Path.of("mappings.txt"), mappings.toString());
152+
}
125153
}

‎testData/results/custom-classes/Pop2Sample.dec

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import javax.swing.JPanel;
99
import javax.swing.colorchooser.AbstractColorChooserPanel;
1010

1111
class Ld implements Runnable {
12+
@Override
1213
public void run() {
1314
AbstractColorChooserPanel[] var5;
1415
JColorChooser var7;
Binary file not shown.

‎testData/results/custom-classes/zkm/sample2/a/a/a/a/a4.dec

+17-11
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class a4 {
4141
}
4242

4343
private static List b(Predicate var0) {
44-
return (List)a(new Object[0]).stream().filter(var0).collect(Collectors.toList());
44+
return a(new Object[0]).stream().filter(var0).collect(Collectors.toList());
4545
}
4646

4747
public static Set a() {
@@ -52,10 +52,14 @@ public class a4 {
5252
long var10000 = 31437394211371L ^ var0;
5353
return var2 == null
5454
? Collections.emptyList()
55-
: (List)e.computeIfAbsent(
55+
: e.computeIfAbsent(
5656
var2,
5757
var1 -> Collections.unmodifiableList(
58-
b(new Object[]{(Predicate)var1x -> var2.equals(var1x.getLanguage()) && !var1x.getCountry().isEmpty() && var1x.getVariant().isEmpty()})
58+
b(
59+
new Object[]{
60+
(Predicate<Locale>)var1x -> var2.equals(var1x.getLanguage()) && !var1x.getCountry().isEmpty() && var1x.getVariant().isEmpty()
61+
}
62+
)
5963
)
6064
);
6165
}
@@ -91,9 +95,11 @@ public class a4 {
9195
long var10000 = 31437394211371L ^ var1;
9296
return var0 == null
9397
? Collections.emptyList()
94-
: (List)d.computeIfAbsent(
98+
: d.computeIfAbsent(
9599
var0,
96-
var1x -> Collections.unmodifiableList(b(new Object[]{(Predicate)var1xx -> var0.equals(var1xx.getCountry()) && var1xx.getVariant().isEmpty()}))
100+
var1x -> Collections.unmodifiableList(
101+
b(new Object[]{(Predicate<Locale>)var1xx -> var0.equals(var1xx.getCountry()) && var1xx.getVariant().isEmpty()})
102+
)
97103
);
98104
}
99105

@@ -403,8 +409,8 @@ public class a4 {
403409
k = new Integer[6];
404410
c = (char)b<"f">(16481, 4871103691199342599L);
405411
a = (char)b<"f">(4103, 7748647110630619232L);
406-
d = new ConcurrentHashMap();
407-
e = new ConcurrentHashMap();
412+
d = new ConcurrentHashMap<>();
413+
e = new ConcurrentHashMap<>();
408414
return;
409415
}
410416
break;
@@ -522,7 +528,7 @@ public class a4 {
522528
long var5 = (Long)var3[1];
523529
String var7 = a(var4, var5);
524530
MethodHandle var8 = MethodHandles.constant(String.class, var7);
525-
var1.setTarget(MethodHandles.dropArguments(var8, 0, new Class[]{int.class, long.class}));
531+
var1.setTarget(MethodHandles.dropArguments(var8, 0, int.class, long.class));
526532
return var7;
527533
}
528534

@@ -532,7 +538,7 @@ public class a4 {
532538
try {
533539
var3.setTarget(
534540
MethodHandles.explicitCastArguments(
535-
MethodHandles.insertArguments("a".asCollector(Object[].class, var2.parameterCount()), 0, new Object[]{var0, var3, var1}), var2
541+
MethodHandles.insertArguments("a".asCollector(Object[].class, var2.parameterCount()), 0, var0, var3, var1), var2
536542
)
537543
);
538544
return var3;
@@ -596,7 +602,7 @@ public class a4 {
596602
long var5 = (Long)var3[1];
597603
int var7 = b(var4, var5);
598604
MethodHandle var8 = MethodHandles.constant(int.class, var7);
599-
var1.setTarget(MethodHandles.dropArguments(var8, 0, new Class[]{int.class, long.class}));
605+
var1.setTarget(MethodHandles.dropArguments(var8, 0, int.class, long.class));
600606
return var7;
601607
}
602608

@@ -606,7 +612,7 @@ public class a4 {
606612
try {
607613
var3.setTarget(
608614
MethodHandles.explicitCastArguments(
609-
MethodHandles.insertArguments("b".asCollector(Object[].class, var2.parameterCount()), 0, new Object[]{var0, var3, var1}), var2
615+
MethodHandles.insertArguments("b".asCollector(Object[].class, var2.parameterCount()), 0, var0, var3, var1), var2
610616
)
611617
);
612618
return var3;

‎testData/results/custom-classes/zkm/sample2/a/a/a/a/a_.dec

+13-10
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public class a_<T> implements Serializable {
122122
this.a = var6;
123123
}
124124

125-
if (this.a.compare(var1, var2) < 1) {
125+
if (this.a.compare((T)var1, (T)var2) < 1) {
126126
this.d = (T)var1;
127127
this.c = (T)var2;
128128
} else {
@@ -133,7 +133,7 @@ public class a_<T> implements Serializable {
133133

134134
public boolean a(Object var1, long var2) {
135135
long var10000 = 104039320445854L ^ var2;
136-
return var1 == null ? false : this.a.compare(var1, this.d) > -1 && this.a.compare(var1, this.c) < 1;
136+
return var1 == null ? false : this.a.compare((T)var1, this.d) > -1 && this.a.compare((T)var1, this.c) < 1;
137137
}
138138

139139
public boolean b(a_ var1, long var2) {
@@ -154,6 +154,7 @@ public class a_<T> implements Serializable {
154154
}
155155
}
156156

157+
@Override
157158
public boolean equals(Object var1) {
158159
if (var1 == this) {
159160
return true;
@@ -189,6 +190,7 @@ public class a_<T> implements Serializable {
189190
return this.d;
190191
}
191192

193+
@Override
192194
public int hashCode() {
193195
int var3 = this.b;
194196
if (this.b == 0) {
@@ -275,7 +277,7 @@ public class a_<T> implements Serializable {
275277

276278
public boolean c(long var1, Object var3) {
277279
long var10000 = 104039320445854L ^ var1;
278-
return var3 == null ? false : this.a.compare(var3, this.d) < 0;
280+
return var3 == null ? false : this.a.compare((T)var3, this.d) < 0;
279281
}
280282

281283
public boolean d(long var1, a_ var3) {
@@ -291,7 +293,7 @@ public class a_<T> implements Serializable {
291293

292294
public boolean e(Object var1, long var2) {
293295
long var10000 = 104039320445854L ^ var2;
294-
return var1 == null ? false : this.a.compare(var1, this.c) > 0;
296+
return var1 == null ? false : this.a.compare((T)var1, this.c) > 0;
295297
}
296298

297299
public boolean f(long var1, a_ var3) {
@@ -302,7 +304,7 @@ public class a_<T> implements Serializable {
302304

303305
public boolean g(Object var1, long var2) {
304306
long var10000 = 104039320445854L ^ var2;
305-
return var1 == null ? false : this.a.compare(var1, this.c) == 0;
307+
return var1 == null ? false : this.a.compare((T)var1, this.c) == 0;
306308
}
307309

308310
public boolean h(long var1) {
@@ -338,9 +340,10 @@ public class a_<T> implements Serializable {
338340

339341
public boolean j(long var1, Object var3) {
340342
long var10000 = 104039320445854L ^ var1;
341-
return var3 == null ? false : this.a.compare(var3, this.d) == 0;
343+
return var3 == null ? false : this.a.compare((T)var3, this.d) == 0;
342344
}
343345

346+
@Override
344347
public String toString() {
345348
if (this.e == null) {
346349
this.e = "[" + this.d + a<"c">(18317, 6648620723262088254L) + this.c + "]";
@@ -530,7 +533,7 @@ public class a_<T> implements Serializable {
530533
long var5 = (Long)var3[1];
531534
String var7 = a(var4, var5);
532535
MethodHandle var8 = MethodHandles.constant(String.class, var7);
533-
var1.setTarget(MethodHandles.dropArguments(var8, 0, new Class[]{int.class, long.class}));
536+
var1.setTarget(MethodHandles.dropArguments(var8, 0, int.class, long.class));
534537
return var7;
535538
}
536539

@@ -540,7 +543,7 @@ public class a_<T> implements Serializable {
540543
try {
541544
var3.setTarget(
542545
MethodHandles.explicitCastArguments(
543-
MethodHandles.insertArguments("a".asCollector(Object[].class, var2.parameterCount()), 0, new Object[]{var0, var3, var1}), var2
546+
MethodHandles.insertArguments("a".asCollector(Object[].class, var2.parameterCount()), 0, var0, var3, var1), var2
544547
)
545548
);
546549
return var3;
@@ -604,7 +607,7 @@ public class a_<T> implements Serializable {
604607
long var5 = (Long)var3[1];
605608
int var7 = b(var4, var5);
606609
MethodHandle var8 = MethodHandles.constant(int.class, var7);
607-
var1.setTarget(MethodHandles.dropArguments(var8, 0, new Class[]{int.class, long.class}));
610+
var1.setTarget(MethodHandles.dropArguments(var8, 0, int.class, long.class));
608611
return var7;
609612
}
610613

@@ -614,7 +617,7 @@ public class a_<T> implements Serializable {
614617
try {
615618
var3.setTarget(
616619
MethodHandles.explicitCastArguments(
617-
MethodHandles.insertArguments("b".asCollector(Object[].class, var2.parameterCount()), 0, new Object[]{var0, var3, var1}), var2
620+
MethodHandles.insertArguments("b".asCollector(Object[].class, var2.parameterCount()), 0, var0, var3, var1), var2
618621
)
619622
);
620623
return var3;

‎testData/results/custom-jars/SnakeGame-obf-zkm/a.dec

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import java.awt.event.KeyAdapter;
22
import java.awt.event.KeyEvent;
33

44
public class a extends KeyAdapter {
5+
@Override
56
public void keyPressed(KeyEvent var1) {
67
boolean var4;
78
label60: {

‎testData/results/custom-jars/SnakeGame-obf-zkm/b.dec

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import java.awt.Color;
22
import java.util.ArrayList;
33

44
public class b {
5-
ArrayList<Color> a = new ArrayList();
5+
ArrayList<Color> a = new ArrayList<>();
66
int b;
77
f c;
88

@@ -11,10 +11,10 @@ public class b {
1111
this.a.add(Color.BLUE);
1212
this.a.add(Color.white);
1313
this.b = var1;
14-
this.c = new f((Color)this.a.get(this.b));
14+
this.c = new f(this.a.get(this.b));
1515
}
1616

1717
public void a(int var1) {
18-
this.c.a(new Object[]{(Color)this.a.get(var1)});
18+
this.c.a(new Object[]{this.a.get(var1)});
1919
}
2020
}

‎testData/results/custom-jars/SnakeGame-obf-zkm/d.dec

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import java.util.ArrayList;
22
import java.util.Iterator;
33

44
public class d extends Thread {
5-
ArrayList<ArrayList<b>> a = new ArrayList();
5+
ArrayList<ArrayList<b>> a = new ArrayList<>();
66
c b;
77
int c;
88
long d;
@@ -19,7 +19,7 @@ public class d extends Thread {
1919
d(long var1, c var3) {
2020
this.c = a(20214, 210489315596258668L ^ var1);
2121
this.d = m;
22-
this.f = new ArrayList();
22+
this.f = new ArrayList<>();
2323
this.a = e.a;
2424
boolean var10000 = h;
2525
this.b = new c(var3.a, var3.b);
@@ -45,6 +45,7 @@ public class d extends Thread {
4545
c.c = var10000;
4646
}
4747

48+
@Override
4849
public void run() {
4950
long var3 = 12972172530972L;
5051
long var5 = 121593940001805L;
@@ -79,7 +80,7 @@ public class d extends Thread {
7980
long var4 = var1 ^ 110402980100581L;
8081
long var6 = var1 ^ 34179827676109L;
8182
int var10000 = h;
82-
c var9 = (c)this.f.get(this.f.size() - 1);
83+
c var9 = this.f.get(this.f.size() - 1);
8384
byte var8 = (byte)var10000;
8485
int var10 = 0;
8586

@@ -91,7 +92,7 @@ public class d extends Thread {
9192
c var10001;
9293
if (var10 <= this.f.size() - 2) {
9394
var10000 = var9.a(new Object[0]);
94-
var10001 = (c)this.f.get(var10);
95+
var10001 = this.f.get(var10);
9596
} else {
9697
var10000 = var9.a(new Object[0]);
9798
var10001 = this.g;
@@ -116,7 +117,7 @@ public class d extends Thread {
116117
if (var10000 == var17) {
117118
var10000 = var9.b(new Object[0]);
118119
if (var8 == 0) {
119-
var10000 = var10000 == ((c)this.f.get(var10)).b(new Object[0]) ? 1 : 0;
120+
var10000 = var10000 == this.f.get(var10).b(new Object[0]) ? 1 : 0;
120121
}
121122
} else {
122123
var10000 = 0;
@@ -210,7 +211,7 @@ public class d extends Thread {
210211
}
211212

212213
private void d(c var1) {
213-
((b)((ArrayList)this.a.get(var1.a)).get(var1.b)).a(new Object[]{1});
214+
this.a.get(var1.a).get(var1.b).a(new Object[]{1});
214215
}
215216

216217
// $VF: Irreducible bytecode was duplicated to produce valid code
@@ -237,7 +238,7 @@ public class d extends Thread {
237238

238239
label58: {
239240
var10000 = var5.b(new Object[var10001]);
240-
var10001 = ((c)this.f.get(var10)).a(new Object[0]);
241+
var10001 = this.f.get(var10).a(new Object[0]);
241242
byte var10002 = var4;
242243
if (var1 >= 0L) {
243244
if (var4 == 0) {
@@ -246,7 +247,7 @@ public class d extends Thread {
246247
}
247248

248249
var10000 = var5.a(new Object[0]);
249-
var10001 = ((c)this.f.get(var10)).b(new Object[0]);
250+
var10001 = this.f.get(var10).b(new Object[0]);
250251
var10002 = var4;
251252
} else {
252253
var10002 = var4;
@@ -453,7 +454,7 @@ public class d extends Thread {
453454
c var6 = (c)var5.next();
454455
int var7 = var6.a(new Object[0]);
455456
int var8 = var6.b(new Object[0]);
456-
((b)((ArrayList)this.a.get(var8)).get(var7)).a(new Object[]{0});
457+
this.a.get(var8).get(var7).a(new Object[]{0});
457458
if (var4) {
458459
break;
459460
}

‎testData/results/custom-jars/SnakeGame-obf-zkm/e.dec

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class e extends JFrame {
1414
long var3 = 61070374780970L;
1515
byte var10000 = d.h;
1616
super();
17-
a = new ArrayList();
17+
a = new ArrayList<>();
1818
boolean var5 = (boolean)var10000;
1919
int var7 = 0;
2020

@@ -63,7 +63,7 @@ class e extends JFrame {
6363

6464
while (true) {
6565
if (var12 < c) {
66-
this.getContentPane().add(((b)((ArrayList)a.get(var7)).get(var12)).c);
66+
this.getContentPane().add(a.get(var7).get(var12).c);
6767
var12++;
6868
if (var5) {
6969
break;

‎testData/results/java/remap/class_1.dec

+2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ public class class_1 {
66
cat.method_2();
77
cat.method_1();
88
cat.method_4();
9+
class_3 runnable = new class_3();
10+
runnable.run();
911
}
1012
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class class_3 implements Runnable {
2+
@Override
3+
public void run() {
4+
System.out.println("Hello, World!");
5+
}
6+
}

‎testData/src/java/src/main/java/remap/Main.java

+3
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ public static void main(String[] args) {
99
cat.play();
1010
cat.sleep();
1111
cat.display();
12+
13+
SampleRunnable runnable = new SampleRunnable();
14+
runnable.run();
1215
}
1316
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package remap;
2+
3+
public class SampleRunnable implements Runnable {
4+
@Override
5+
public void run() {
6+
System.out.println("Hello, World!");
7+
}
8+
}

0 commit comments

Comments
 (0)
Please sign in to comment.