public final String getNameString() { // ConstantString cu8 = (ConstantString)cpool.getConstant(nameIdx); return ((ConstantUtf8) cpool.getConstant(nameIdx)).getBytes(); }
public final String getTypeSignature() { // ConstantClass c = (ConstantClass)cpool.getConstant(typeIndex); final ConstantUtf8 utf8 = (ConstantUtf8) cpool .getConstant(typeIndex/* c.getNameIndex() */); return utf8.getBytes(); }
public String getEnumTypeString() { // Constant cc = getConstantPool().getConstant(typeIdx); // ConstantClass cu8 = // (ConstantClass)getConstantPool().getConstant(typeIdx); // return // ((ConstantUtf8)getConstantPool().getConstant(cu8.getNameIndex())).getBytes(); return ((ConstantUtf8) getConstantPool().getConstant(typeIdx)) .getBytes(); // return Utility.signatureToString(cu8.getBytes()); }
public String getClassString() { final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); // ConstantClass c = (ConstantClass)getConstantPool().getConstant(idx); // ConstantUtf8 utf8 = // (ConstantUtf8)getConstantPool().getConstant(c.getNameIndex()); // return utf8.getBytes(); }
@Override public String stringifyValue() { final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(valueIdx); return cu8.getBytes(); // ConstantString cu8 = // (ConstantString)getConstantPool().getConstant(valueIdx); // return // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes(); }
/** * 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+"'."); } }
public String getEnumValueString() { return ((ConstantUtf8) getConstantPool().getConstant(valueIdx)).getBytes(); // ConstantString cu8 = // (ConstantString)getConstantPool().getConstant(valueIdx); // return // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes(); }
/** * 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+"'."); } }
/** * 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+"'."); } }
/** * Ensures the specific preconditions of the said instruction. */ @Override public void visitLDC2_W(final LDC2_W o) { // visitCPInstruction is called first. final 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+"'."); } }
public int getValueInt() { if (super.getElementValueType() != PRIMITIVE_INT) { throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } final ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); return c.getBytes(); }
public String getValueString() { if (super.getElementValueType() != STRING) { throw new RuntimeException( "Dont call getValueString() on a non STRING ElementValue"); } final ConstantUtf8 c = (ConstantUtf8) getConstantPool().getConstant(idx); return c.getBytes(); }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ public void visitINSTANCEOF(INSTANCEOF 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+"'."); } }
/** 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+"'."); } }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ @Override public void visitINSTANCEOF(final INSTANCEOF 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+"'."); } }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ @Override public void visitCHECKCAST(final CHECKCAST 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+"'."); } }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ public void visitCHECKCAST(CHECKCAST 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+"'."); } }
/** 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); } } /** Symbolically executes the corresponding Java Virtual Machine instruction. */
/** Symbolically executes the corresponding Java Virtual Machine instruction. */ @Override public void visitLDC2_W(final LDC2_W o) { final Constant c = cpg.getConstant(o.getIndex()); if (c instanceof ConstantLong) { stack().push(Type.LONG); } if (c instanceof ConstantDouble) { stack().push(Type.DOUBLE); } } /** Symbolically executes the corresponding Java Virtual Machine instruction. */
/** * Replace all references to the old constant pool with references to the new constant pool */ public void replaceConstantPool(final ConstantPoolGen old_cp, final ConstantPoolGen new_cp) { for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) { final Instruction i = ih.getInstruction(); if (i instanceof CPInstruction) { final CPInstruction ci = (CPInstruction) i; final Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }