org.apache.bcel.generic.NEW.getIndex()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(97)

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

NEW.getIndex介绍

暂无

代码示例

代码示例来源:origin: bcel/bcel

/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitNEW(NEW o){
  indexValid(o, o.getIndex());
  Constant c = cpg.getConstant(o.getIndex());
  if (!	(c instanceof ConstantClass)){
    constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
  }
  else{
    ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant( ((ConstantClass) c).getNameIndex() ));
    Type t = Type.getType("L"+cutf8.getBytes()+";");
    if (t instanceof ArrayType){
      constraintViolated(o, "NEW must not be used to create an array.");
    }
  }
  
}

代码示例来源:origin: org.apache.bcel/bcel

/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
@Override
public void visitNEW(final NEW o) {
  indexValid(o, o.getIndex());
  final Constant c = cpg.getConstant(o.getIndex());
  if (!    (c instanceof ConstantClass)) {
    constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
  }
  else{
    final ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant( ((ConstantClass) c).getNameIndex() ));
    final Type t = Type.getType("L"+cutf8.getBytes()+";");
    if (t instanceof ArrayType) {
      constraintViolated(o, "NEW must not be used to create an array.");
    }
  }
}

相关文章

微信公众号

最新文章

更多