Exemple #1
0
  private void transformCaptured(@NotNull MethodNode node) {
    if (nodeRemapper.isRoot()) {
      return;
    }

    // Fold all captured variable chain - ALOAD 0 ALOAD this$0 GETFIELD $captured - to GETFIELD
    // $$$$captured
    // On future decoding this field could be inline or unfolded in another field access chain (it
    // can differ in some missed this$0)
    AbstractInsnNode cur = node.instructions.getFirst();
    while (cur != null) {
      if (cur instanceof VarInsnNode && cur.getOpcode() == Opcodes.ALOAD) {
        if (((VarInsnNode) cur).var == 0) {
          List<AbstractInsnNode> accessChain = getCapturedFieldAccessChain((VarInsnNode) cur);
          AbstractInsnNode insnNode = nodeRemapper.foldFieldAccessChainIfNeeded(accessChain, node);
          if (insnNode != null) {
            cur = insnNode;
          }
        }
      }
      cur = cur.getNext();
    }
  }