Examples of ConstantUtf8


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

  public int getTypeIndex() {
    return typeIndex;
  }

  public String getTypeSignature() {
    ConstantUtf8 utf8 = (ConstantUtf8) cpool.getConstant(typeIndex);
    return utf8.getValue();
  }
View Full Code Here

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

   * return signature and value, something like Lp/Color;RED
   */
  @Override
  public String stringifyValue() {
    StringBuffer sb = new StringBuffer();
    ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx, Constants.CONSTANT_Utf8);
    sb.append(cu8.getValue());
    cu8 = (ConstantUtf8) cpool.getConstant(valueIdx, Constants.CONSTANT_Utf8);
    sb.append(cu8.getValue());
    return sb.toString();
  }
View Full Code Here

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

  }

  public String getValueString() {
    if (type != STRING)
      throw new RuntimeException("Dont call getValueString() on a non STRING ElementValue");
    ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(idx);
    return c.getValue();
  }
View Full Code Here

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

      if (bo.getValue() == 0)
        return "false";
      else
        return "true";
    case STRING:
      ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx);
      return cu8.getValue();

    default:
      throw new RuntimeException("SimpleElementValueGen class does not know how to stringify type " + type);
    }
  }
View Full Code Here

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

    dos.writeShort(typeIdx)// u2
    dos.writeShort(valueIdx); // u2
    }
   
    public String stringifyValue() {
      ConstantUtf8 cu8 = (ConstantUtf8)getConstantPool().getConstant(valueIdx);
    return cu8.getBytes();
//      ConstantString cu8 = (ConstantString)getConstantPool().getConstant(valueIdx);
//      return ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
    }
View Full Code Here

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

    }

    public String getValueString() {
      if (type != STRING)
        throw new RuntimeException("Dont call getValueString() on a non STRING ElementValue");
    ConstantUtf8 c = (ConstantUtf8)cpGen.getConstant(idx);
    return c.getBytes();
    }
View Full Code Here

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

        case PRIMITIVE_BOOLEAN:
        ConstantInteger bo = (ConstantInteger)cpGen.getConstant(idx);
        if (bo.getBytes() == 0) return "false";
        if (bo.getBytes() != 0) return "true";
        case STRING:
        ConstantUtf8 cu8 = (ConstantUtf8)cpGen.getConstant(idx);
        return cu8.getBytes();
       
       default:
         throw new RuntimeException("SimpleElementValueGen class does not know how to stringify type "+type);
      }
    }
View Full Code Here

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

    // Adapt the class name to the passed value
    ConstantPool cp = clazz.getConstantPool();

    ConstantClass cl = (ConstantClass)cp.getConstant(clazz.getClassNameIndex(),
                 Constants.CONSTANT_Class);
    ConstantUtf8 name = (ConstantUtf8)cp.getConstant(cl.getNameIndex(),
                 Constants.CONSTANT_Utf8);
    name.setBytes(class_name.replace('.', '/'));

    return clazz;
  }
View Full Code Here

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

          constraintViolated(o, "Indexing a constant that's not a CONSTANT_Methodref but a '"+c+"'.");
        }
        else{
          // Constants are okay due to pass2.
          ConstantNameAndType cnat = (ConstantNameAndType) (cpg.getConstant(((ConstantMethodref) c).getNameAndTypeIndex()));
          ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()));
          if (cutf8.getBytes().equals(Constants.CONSTRUCTOR_NAME) && (!(o instanceof INVOKESPECIAL)) ){
            constraintViolated(o, "Only INVOKESPECIAL is allowed to invoke instance initialization methods.");
          }
          if ( (! (cutf8.getBytes().equals(Constants.CONSTRUCTOR_NAME)) ) && (cutf8.getBytes().startsWith("<")) ){
            constraintViolated(o, "No method with a name beginning with '<' other than the instance initialization methods may be called by the method invocation instructions.");
          }
        }
      }
      else{ //if (o instanceof INVOKEINTERFACE){
View Full Code Here

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

      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.");
        }
      }
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.