Skip to content

Commit b4d83fc

Browse files
committed
Cleanups.
1 parent 8ba9636 commit b4d83fc

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/main/java/codechicken/asm/ASMReader.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package codechicken.asm;
22

33
import org.objectweb.asm.tree.*;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
46

57
import java.io.BufferedReader;
68
import java.io.IOException;
@@ -14,6 +16,8 @@
1416

1517
public class ASMReader {
1618

19+
private static final Logger LOGGER = LoggerFactory.getLogger(ASMReader.class);
20+
1721
public static Map<String, Integer> opCodes = new HashMap<>();
1822
public static byte[] TYPE;
1923

@@ -209,7 +213,7 @@ public static Map<String, ASMBlock> loadResource(InputStream in, String res) {
209213
}
210214
}
211215
line = line.trim();
212-
if (line.length() == 0) {
216+
if (line.isEmpty()) {
213217
continue;
214218
}
215219
if (line.startsWith("list ")) {
@@ -303,8 +307,7 @@ public static Map<String, ASMBlock> loadResource(InputStream in, String res) {
303307
block.list.add(insn);
304308
}
305309
} catch (Exception e) {
306-
System.err.println("Error while reading ASM Block " + current + " from " + res + ", line: " + line);
307-
e.printStackTrace();
310+
LOGGER.error("Error while reading ASM Block {} from {}, line: {}", current, res, line, e);
308311
}
309312
}
310313

src/main/java/codechicken/asm/ClassHierarchyManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public void flatten() {
3535
}
3636
}
3737

38-
public static HashMap<String, SuperCache> superclasses = new HashMap<>();
39-
private static List<Function<String, byte @Nullable []>> CLASS_BYTE_LOOKUPS = new ArrayList<>(0);
38+
public static final HashMap<String, SuperCache> superclasses = new HashMap<>();
39+
private static final List<Function<String, byte @Nullable []>> CLASS_BYTE_LOOKUPS = new ArrayList<>(0);
4040

4141
/**
4242
* Add a factory to find class bytes with.

src/main/java/codechicken/asm/ImportantInsnVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class ImportantInsnVisitor extends ClassVisitor {
99

1010
public ImportantInsnVisitor(ClassVisitor cv) {
11-
super(Opcodes.ASM4, cv);
11+
super(Opcodes.ASM9, cv);
1212
}
1313

1414
@Override
@@ -21,7 +21,7 @@ public class ImportantInsnMethodVisitor extends MethodVisitor {
2121
MethodVisitor delegate;
2222

2323
public ImportantInsnMethodVisitor(int access, String name, String desc, String signature, String[] exceptions) {
24-
super(Opcodes.ASM4, new MethodNode(access, name, desc, signature, exceptions));
24+
super(Opcodes.ASM9, new MethodNode(access, name, desc, signature, exceptions));
2525
delegate = cv.visitMethod(access, name, desc, signature, exceptions);
2626
}
2727

src/main/java/codechicken/asm/StackAnalyser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public static int width(Type[] it) {
4141
}
4242

4343
public static int width(Stream<Type> stream) {
44-
return stream//
45-
.mapToInt(StackAnalyser::width)//
46-
.reduce(Integer::sum)//
44+
return stream
45+
.mapToInt(StackAnalyser::width)
46+
.reduce(Integer::sum)
4747
.orElse(0);
4848
}
4949

0 commit comments

Comments
 (0)