Package org.aspectj.apache.bcel.classfile

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


      referenceTypeIsInitialized(o, (ReferenceType) objectref);
    }
    // The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool of the
    // current class (�3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant
    // pool item at the index must be a symbolic reference to a class, array, or interface type.
    Constant c = cpg.getConstant(o.getIndex());
    if (! (c instanceof ConstantClass)){
      constraintViolated(o, "The Constant at 'index' is not a ConstantClass, but '"+c+"'.");
    }
  }
View Full Code Here


      referenceTypeIsInitialized(o, (ReferenceType) objectref);
    }
    // The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool of the
    // current class (�3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant
    // pool item at the index must be a symbolic reference to a class, array, or interface type.
    Constant c = cpg.getConstant(o.getIndex());
    if (! (c instanceof ConstantClass)){
      constraintViolated(o, "The Constant at 'index' is not a ConstantClass, but '"+c+"'.");
    }
  }
View Full Code Here

   * Ensures the specific preconditions of the said instruction.
   */
  public void visitLDC(LDC o){
    // visitCPInstruction is called first.
   
    Constant c = cpg.getConstant(o.getIndex());
    if   ((  ( c instanceof ConstantInteger) ||
              ( c instanceof ConstantFloat  ||
              ( c instanceof ConstantString )  )  ){
      constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
    }
View Full Code Here

   * Ensures the specific preconditions of the said instruction.
   */
  public void visitLDC_W(LDC_W o){
    // visitCPInstruction is called first.
   
    Constant c = cpg.getConstant(o.getIndex());
    if   ((  ( c instanceof ConstantInteger) ||
              ( c instanceof ConstantFloat  ||
              ( c instanceof ConstantString )  )  ){
      constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
    }
View Full Code Here

   * Ensures the specific preconditions of the said instruction.
   */
  public void visitLDC2_W(LDC2_W o){
    // visitCPInstruction is called first.
   
    Constant c = cpg.getConstant(o.getIndex());
    if   ((  ( c instanceof ConstantLong) ||
              ( c instanceof ConstantDouble )  )  ){
      constraintViolated(o, "Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float or a CONSTANT_String, but is '"+c+"'.");
    }
  }
View Full Code Here

    public static List readAj5ClassAttributes(JavaClass javaClass, ReferenceType type, ISourceContext context, IMessageHandler msgHandler, boolean isCodeStyleAspect) {
        //FIXME AV - 1.5 feature limitation, kick after implemented
        try {
            Constant[] cpool = javaClass.getConstantPool().getConstantPool();
            for (int i = 0; i < cpool.length; i++) {
                Constant constant = cpool[i];
                if (constant != null && constant.getTag() == Constants.CONSTANT_Utf8) {
                    if (!javaClass.getClassName().startsWith("org.aspectj.lang.annotation")) {
                        ConstantUtf8 constantUtf8 = (ConstantUtf8) constant;
                        if ("Lorg/aspectj/lang/annotation/DeclareAnnotation;".equals(constantUtf8.getBytes())) {
                            msgHandler.handleMessage(
                                    new Message(
View Full Code Here

    }
  }

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

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

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

    if(cs.length > 0)
      index = cs.length;

    for(int i=1; i < index; i++) {
      Constant c = constants[i];

      if(c instanceof ConstantString) {
  ConstantString s  = (ConstantString)c;
  ConstantUtf8   u8 = (ConstantUtf8)constants[s.getStringIndex()];
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.