Package org.aspectj.apache.bcel.classfile

Examples of org.aspectj.apache.bcel.classfile.Constant


    for (InstructionHandle ih = start; ih != null; ih = ih.next) {
      Instruction i = ih.instruction;

      if (i.isConstantPoolInstruction()) {
        InstructionCP ci = (InstructionCP) i;
        Constant c = old_cp.getConstant(ci.getIndex());
        ci.setIndex(new_cp.addConstant(c, old_cp));
      }
    }
  }
View Full Code Here


    }
  }

  public void setValue(int index) {
    ConstantPool cp = this.cp;
    Constant c = cp.getConstant(index);
    value = ((ConstantObject) c).getConstantValue(cp);
  }
View Full Code Here

    public boolean innerClassReferenced(){
      return hasInnerClass;
    }
    /** This method casually visits ConstantClass references. */
    public void visitConstantClass(ConstantClass obj){
      Constant c = cp.getConstant(obj.getNameIndex());
      if (c instanceof ConstantUtf8){ //Ignore the case where it's not a ConstantUtf8 here, we'll find out later.
        String classname = ((ConstantUtf8) c).getBytes();
        if (classname.startsWith(jc.getClassName().replace('.','/')+"$")){
          hasInnerClass = true;
        }
View Full Code Here

    private void checkIndex(Node referrer, int index, Class shouldbe){
      if ((index < 0) || (index >= cplen)){
        throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(referrer)+"'.");
      }
      Constant c = cp.getConstant(index);
      if (! shouldbe.isInstance(c)){
        /* String isnot = shouldbe.toString().substring(shouldbe.toString().lastIndexOf(".")+1); //Cut all before last "." */
        throw new ClassCastException("Illegal constant '"+tostring(c)+"' at index '"+index+"'. '"+tostring(referrer)+"' expects a '"+shouldbe+"'.");
      }
    }
View Full Code Here

        int index = obj.getConstantValueIndex();
        if ((index < 0) || (index >= cplen)){
          throw new ClassConstraintException("Invalid index '"+index+"' used by '"+tostring(obj)+"'.");
        }
        Constant c = cp.getConstant(index);

        if (CONST_Long.isInstance(c) && field_type.equals(Type.LONG)){
          return;
        }
        if (CONST_Float.isInstance(c) && field_type.equals(Type.FLOAT)){
View Full Code Here

  public void visitLCONST(LCONST o){
    stack().push(Type.LONG);
  }
  /** Symbolically executes the corresponding Java Virtual Machine instruction. */
  public void visitLDC(LDC o){
    Constant c = cpg.getConstant(o.getIndex());
    if (c instanceof ConstantInteger){
      stack().push(Type.INT);
    }
    if (c instanceof ConstantFloat){
      stack().push(Type.FLOAT);
View Full Code Here

      stack().push(Type.STRING);
    }
  }
  /** Symbolically executes the corresponding Java Virtual Machine instruction. */
  public void visitLDC_W(LDC_W o){
    Constant c = cpg.getConstant(o.getIndex());
    if (c instanceof ConstantInteger){
      stack().push(Type.INT);
    }
    if (c instanceof ConstantFloat){
      stack().push(Type.FLOAT);
View Full Code Here

      stack().push(Type.STRING);
    }
  }
  /** Symbolically executes the corresponding Java Virtual Machine instruction. */
  public void visitLDC2_W(LDC2_W o){
    Constant c = cpg.getConstant(o.getIndex());
    if (c instanceof ConstantLong){
      stack().push(Type.LONG);
    }
    if (c instanceof ConstantDouble){
      stack().push(Type.DOUBLE);
View Full Code Here

   
    /** Checks if the constraints of operands of the said instruction(s) are satisfied. */
    // LDC and LDC_W (LDC_W is a subclass of LDC in BCEL's model)
    public void visitLDC(LDC o){
      indexValid(o, o.getIndex());
      Constant c = cpg.getConstant(o.getIndex());
      if (! ( (c instanceof ConstantInteger||
              (c instanceof ConstantFloat)     ||
              (c instanceof ConstantString) ) ){
        constraintViolated(o, "Operand of LDC or LDC_W must be one of CONSTANT_Integer, CONSTANT_Float or CONSTANT_String, but is '"+c+"'.");
      }
View Full Code Here

    /** Checks if the constraints of operands of the said instruction(s) are satisfied. */
    // LDC2_W
    public void visitLDC2_W(LDC2_W o){
      indexValid(o, o.getIndex());
      Constant c = cpg.getConstant(o.getIndex());
      if (! ( (c instanceof ConstantLong||
              (c instanceof ConstantDouble) ) ){
        constraintViolated(o, "Operand of LDC2_W must be CONSTANT_Long or CONSTANT_Double, but is '"+c+"'.");
      }
      try{
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.Constant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.