simplify interface scanning

This commit is contained in:
JFronny 2021-10-17 11:05:14 +02:00
parent 59826e7cca
commit a79571fa92
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
1 changed files with 5 additions and 13 deletions

View File

@ -6,10 +6,7 @@ import io.gitlab.jfronny.libjf.unsafe.asm.patch.Patch;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
public class InterfaceImplTargetPatch implements Patch {
public static final Map<String, Set<String>> INTERFACES = new HashMap<>();
@ -32,15 +29,10 @@ public class InterfaceImplTargetPatch implements Patch {
private static void scanInterfaces(ClassNode klazz) {
if (INTERFACES.containsKey(klazz.name)) return;
INTERFACES.put(klazz.name, new HashSet<>());
for (String anInterface : klazz.interfaces) {
INTERFACES.get(klazz.name).add(anInterface);
}
if (klazz.superName != null) {
INTERFACES.get(klazz.name).add(klazz.superName);
}
INTERFACES.put(klazz.name, Set.copyOf(INTERFACES.get(klazz.name)));
for (String s : INTERFACES.get(klazz.name)) {
List<String> hs = new ArrayList<>(klazz.interfaces);
if (klazz.superName != null) hs.add(klazz.superName);
INTERFACES.put(klazz.name, Set.copyOf(hs));
for (String s : hs) {
String n = s.replace('/', '.');
if (AsmTransformer.isClassUnmoddable(n, AsmTransformer.INSTANCE.getCurrentConfig()))
continue;