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) {
List<AbstractInsnNode> realInsns = new ArrayList<>();
for (var it = list.iterator(); it.hasNext(); ) {
var insn = it.next();
for (var insn : list) {
if (insn.getOpcode() != -1) {
realInsns.add(insn);
}

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

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

Loading…
Cancel
Save