org.objectweb.asm.tree.TryCatchBlockNode.updateIndex()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.objectweb.asm.tree.TryCatchBlockNode.updateIndex()方法的一些代码示例,展示了TryCatchBlockNode.updateIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TryCatchBlockNode.updateIndex()方法的具体详情如下:
包路径:org.objectweb.asm.tree.TryCatchBlockNode
类名称:TryCatchBlockNode
方法名:updateIndex

TryCatchBlockNode.updateIndex介绍

[英]Updates the index of this try catch block in the method's list of try catch block nodes. This index maybe stored in the 'target' field of the type annotations of this block.
[中]更新方法的try-catch块节点列表中此try-catch块的索引。该索引可能存储在该块的类型注释的“target”字段中。

代码示例

代码示例来源:origin: org.ow2.asm/asm-commons

@Override
 public void visitEnd() {
  // Sort the TryCatchBlockNode elements by the length of their "try" block.
  Collections.sort(
    tryCatchBlocks,
    new Comparator<TryCatchBlockNode>() {

     @Override
     public int compare(
       final TryCatchBlockNode tryCatchBlockNode1,
       final TryCatchBlockNode tryCatchBlockNode2) {
      return blockLength(tryCatchBlockNode1) - blockLength(tryCatchBlockNode2);
     }

     private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
      int startIndex = instructions.indexOf(tryCatchBlockNode.start);
      int endIndex = instructions.indexOf(tryCatchBlockNode.end);
      return endIndex - startIndex;
     }
    });
  // Update the 'target' of each try catch block annotation.
  for (int i = 0; i < tryCatchBlocks.size(); ++i) {
   tryCatchBlocks.get(i).updateIndex(i);
  }
  if (mv != null) {
   accept(mv);
  }
 }
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

@Override
  public void visitEnd() {
    // Compares TryCatchBlockNodes by the length of their "try" block.
    Comparator<TryCatchBlockNode> comp = new Comparator<TryCatchBlockNode>() {

      public int compare(TryCatchBlockNode t1, TryCatchBlockNode t2) {
        int len1 = blockLength(t1);
        int len2 = blockLength(t2);
        return len1 - len2;
      }

      private int blockLength(TryCatchBlockNode block) {
        int startidx = instructions.indexOf(block.start);
        int endidx = instructions.indexOf(block.end);
        return endidx - startidx;
      }
    };
    Collections.sort(tryCatchBlocks, comp);
    // Updates the 'target' of each try catch block annotation.
    for (int i = 0; i < tryCatchBlocks.size(); ++i) {
      tryCatchBlocks.get(i).updateIndex(i);
    }
    if (mv != null) {
      accept(mv);
    }
  }
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

@Override
 public void visitEnd() {
  // Sort the TryCatchBlockNode elements by the length of their "try" block.
  Collections.sort(
    tryCatchBlocks,
    new Comparator<TryCatchBlockNode>() {

     @Override
     public int compare(
       final TryCatchBlockNode tryCatchBlockNode1,
       final TryCatchBlockNode tryCatchBlockNode2) {
      return blockLength(tryCatchBlockNode1) - blockLength(tryCatchBlockNode2);
     }

     private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
      int startIndex = instructions.indexOf(tryCatchBlockNode.start);
      int endIndex = instructions.indexOf(tryCatchBlockNode.end);
      return endIndex - startIndex;
     }
    });
  // Update the 'target' of each try catch block annotation.
  for (int i = 0; i < tryCatchBlocks.size(); ++i) {
   tryCatchBlocks.get(i).updateIndex(i);
  }
  if (mv != null) {
   accept(mv);
  }
 }
}

代码示例来源:origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

@Override
 public void visitEnd() {
  // Sort the TryCatchBlockNode elements by the length of their "try" block.
  Collections.sort(
    tryCatchBlocks,
    new Comparator<TryCatchBlockNode>() {

     @Override
     public int compare(
       final TryCatchBlockNode tryCatchBlockNode1,
       final TryCatchBlockNode tryCatchBlockNode2) {
      return blockLength(tryCatchBlockNode1) - blockLength(tryCatchBlockNode2);
     }

     private int blockLength(final TryCatchBlockNode tryCatchBlockNode) {
      int startIndex = instructions.indexOf(tryCatchBlockNode.start);
      int endIndex = instructions.indexOf(tryCatchBlockNode.end);
      return endIndex - startIndex;
     }
    });
  // Update the 'target' of each try catch block annotation.
  for (int i = 0; i < tryCatchBlocks.size(); ++i) {
   tryCatchBlocks.get(i).updateIndex(i);
  }
  if (mv != null) {
   accept(mv);
  }
 }
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

tryCatchBlocks.get(i).updateIndex(i);
tryCatchBlocks.get(i).accept(mv);

代码示例来源:origin: org.ow2.asm/asm-tree

tryCatchBlocks.get(i).updateIndex(i);
tryCatchBlocks.get(i).accept(methodVisitor);

相关文章

微信公众号

最新文章

更多