Use for-each to iterate over InsnLists

master
Graham 5 years ago
parent e9fb758611
commit a26efcb30c
  1. 3
      asm/src/main/java/dev/openrs2/asm/InsnMatcher.java
  2. 3
      asm/src/main/java/dev/openrs2/asm/MethodNodeUtils.java
  3. 3
      bundler/src/main/java/dev/openrs2/bundler/transform/CachePathTransformer.java

@ -225,8 +225,7 @@ public final class InsnMatcher {
private static List<AbstractInsnNode> createRealInsnList(InsnList list) { private static List<AbstractInsnNode> createRealInsnList(InsnList list) {
List<AbstractInsnNode> realInsns = new ArrayList<>(); List<AbstractInsnNode> realInsns = new ArrayList<>();
for (var it = list.iterator(); it.hasNext(); ) { for (var insn : list) {
var insn = it.next();
if (insn.getOpcode() != -1) { if (insn.getOpcode() != -1) {
realInsns.add(insn); realInsns.add(insn);
} }

@ -109,8 +109,7 @@ public final class MethodNodeUtils {
method.invisibleLocalVariableAnnotations.forEach(v -> v.index = remapAll(v.index, argType, localIndex)); method.invisibleLocalVariableAnnotations.forEach(v -> v.index = remapAll(v.index, argType, localIndex));
} }
for (var it = method.instructions.iterator(); it.hasNext(); ) { for (var insn : method.instructions) {
var insn = it.next();
switch (insn.getType()) { switch (insn.getType()) {
case AbstractInsnNode.VAR_INSN: case AbstractInsnNode.VAR_INSN:
var varInsn = (VarInsnNode) insn; var varInsn = (VarInsnNode) insn;

@ -22,8 +22,7 @@ public final class CachePathTransformer extends Transformer {
@Override @Override
protected boolean transformCode(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) { protected boolean transformCode(ClassPath classPath, Library library, ClassNode clazz, MethodNode method) {
for (var it = method.instructions.iterator(); it.hasNext(); ) { for (var insn : method.instructions) {
var insn = it.next();
if (insn.getOpcode() != Opcodes.LDC) { if (insn.getOpcode() != Opcodes.LDC) {
continue; continue;
} }

Loading…
Cancel
Save