another ~0.03s less :3

This commit is contained in:
moehreag 2024-05-28 12:26:55 +02:00
parent 1dcd0c8c05
commit dd8b87a1cf

View file

@ -103,7 +103,7 @@ class AWProcessor {
classNames.parallelStream().forEach(name -> {
try {
processFile(out.getPath("/" + name + ".class"), classMap, fields, methods, mutations);
processFile(name, out.getPath("/" + name + ".class"), classMap, fields, methods, mutations);
} catch (IOException e) {
throw new Error(e);
}
@ -113,9 +113,7 @@ class AWProcessor {
LOGGER.info(String.format("Applied AccessWideners in %.2fs", (System.currentTimeMillis() - startTime) / 1000f));
}
private static void processFile(Path file, Map<String, Entry> classMap, Map<String, Map<String, Entry>> fields, Map<String, Map<String, Entry>> methods, Map<String, Map<String, Entry>> mutations) throws IOException {
var className = file.toString().substring(1, file.toString().length() - 6);
if (file.getFileName().toString().endsWith(".class") && (classMap.containsKey(className) || fields.containsKey(className) || methods.containsKey(className) || mutations.containsKey(className))) {
private static void processFile(String className, Path file, Map<String, Entry> classMap, Map<String, Map<String, Entry>> fields, Map<String, Map<String, Entry>> methods, Map<String, Map<String, Entry>> mutations) throws IOException {
ClassReader reader = new ClassReader(Files.newInputStream(file));
ClassWriter writer = new ClassWriter(0);
ClassVisitor mapper = new ClassVisitor(Opcodes.ASM9, writer) {
@ -170,7 +168,6 @@ class AWProcessor {
Files.write(file, writer.toByteArray());
}
}
private record Entry(AccessType type, String targetType, String className, String name, String descriptor) {