Compare commits

...
4 Commits
Author SHA1 Message Date
Jason Mitchell 60d44f3c7b Skip MR class files (#49) 2026-06-16 10:35:36 -07:00
Ranzu 6209831d08 Revert #47 (#48) 2026-06-07 19:36:40 +00:00
Ranzu 7ae8b15810 Convert colors to ColorUtils (#47) 2026-06-07 19:17:10 +02:00
Alexdoru 08f3e4d42a intern superclass and interfaces of ClassHeirachyManager data (#46) 2026-05-24 15:19:20 +02:00
2 changed files with 11 additions and 4 deletions

No files matched your search

@@ -116,6 +116,7 @@ public class ClassDiscoverer {
while (zipEntries.hasMoreElements()) {
ZipEntry zipentry = zipEntries.nextElement();
String fullname = zipentry.getName().replace('\\', '/');
if (fullname.startsWith("META-INF/versions/")) continue;
int pos = fullname.lastIndexOf('/');
String name = pos == -1 ? fullname : fullname.substring(pos + 1);
if (!zipentry.isDirectory() && matcher.matches(name)) {
@@ -2,6 +2,7 @@ package codechicken.lib.asm;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;
@@ -107,6 +108,7 @@ public class ClassHeirachyManager implements IClassTransformer {
private static class ClassInfo {
public static final ClassInfo OBJECT = new ClassInfo();
private static final Map<String, String> STRING_POOL = new ConcurrentHashMap<>(256);
public final String superclass;
public final String[] interfaces;
@@ -125,7 +127,7 @@ public class ClassHeirachyManager implements IClassTransformer {
superclass = "java.lang.Object";
parent = OBJECT;
} else {
superclass = toKey(superName);
superclass = pool(toKey(superName));
}
if (interfaces == null || interfaces.length == 0) {
@@ -133,7 +135,7 @@ public class ClassHeirachyManager implements IClassTransformer {
} else {
this.interfaces = new String[interfaces.length];
for (int i = 0; i < interfaces.length; i++) {
this.interfaces[i] = toKey(interfaces[i]);
this.interfaces[i] = pool(toKey(interfaces[i]));
}
}
}
@@ -148,7 +150,7 @@ public class ClassHeirachyManager implements IClassTransformer {
this.superclass = "java.lang.Object";
this.parent = OBJECT;
} else {
this.superclass = toKey(superclass.getName());
this.superclass = pool(toKey(superclass.getName()));
}
}
final Class<?>[] interfaces = aclass.getInterfaces();
@@ -157,7 +159,7 @@ public class ClassHeirachyManager implements IClassTransformer {
} else {
this.interfaces = new String[interfaces.length];
for (int i = 0; i < interfaces.length; i++) {
this.interfaces[i] = toKey(interfaces[i].getName());
this.interfaces[i] = pool(toKey(interfaces[i].getName()));
}
}
}
@@ -172,5 +174,9 @@ public class ClassHeirachyManager implements IClassTransformer {
this.parent = parentInfo;
return parentInfo.hasSuper(superclass);
}
private static String pool(String s) {
return STRING_POOL.computeIfAbsent(s, Function.identity());
}
}
}