simplify interface scanning
This commit is contained in:
parent
59826e7cca
commit
a79571fa92
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue