@Override public void visitLDC(LDC obj) { Object constantValue = obj.getValue(cpg); ValueNumber value; if (constantValue instanceof ConstantClass) { ConstantClass constantClass = (ConstantClass) constantValue; String className = constantClass.getBytes(cpg.getConstantPool()); value = factory.getClassObjectValue(className); } else if (constantValue instanceof ObjectType) { ObjectType objectType = (ObjectType) constantValue; String className = objectType.getClassName(); value = factory.getClassObjectValue(className); } else { value = constantValueMap.get(constantValue); if (value == null) { value = factory.createFreshValue(ValueNumber.CONSTANT_VALUE); constantValueMap.put(constantValue, value); // Keep track of String constants if (constantValue instanceof String) { stringConstantMap.put(value, (String) constantValue); } } } getFrame().pushValue(value); }
cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); dups.add(varRef);
System.out.println(" " + ins.toString(cpg.getConstantPool()));
Context context = new Context(cfg.getMethodGen().getConstantPool().getConstantPool(), method.getCode().getLocalVariableTable(), getParameterTypes(descriptor), classContext.getValueNumberDataflow(method)); Map<ValueNumber, VariableData> analyzedArguments = new HashMap<>();
copyAreaCPG.addUtf8(copyAreaFieldName), copyAreaCPG.addUtf8(varSignature), null, copyAreaCPG.getConstantPool()));
cpg.addUtf8(name), cpg.addUtf8(signature), null, cpg.getConstantPool()));
cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool())); dups.add(varRef);
cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool()));
cpg.addUtf8(var.getEscapedName()), cpg.addUtf8(var.getType().toSignature()), null, cpg.getConstantPool()));
cpg.addUtf8(NODE_COUNTER_SIG), null, cpg.getConstantPool());
classGen.addField(new Field(ACC_PUBLIC, cpg.addUtf8(name), cpg.addUtf8(signature), null, cpg.getConstantPool())); il.append(classGen.loadTranslet()); il.append(DUP);
cpg.addUtf8(iteratorName), cpg.addUtf8(NODE_ITERATOR_SIG), null, cpg.getConstantPool()); classGen.addField(iterator); iteratorIndex = cpg.addFieldref(classGen.getClassName(),
public void setSuperclassNameIndex( final int superclass_name_index ) { this.superclass_name_index = superclass_name_index; super_class_name = cp.getConstantPool().getConstantString(superclass_name_index, Const.CONSTANT_Class).replace('/', '.'); }
/** @return type related with this instruction. */ public Type getType(ConstantPoolGen cpg) { ConstantPool cp = cpg.getConstantPool(); String name = cp.getConstantString(index, org.apache.bcel.Constants.CONSTANT_Class); if(!name.startsWith("[")) name = "L" + name + ";"; return Type.getType(name); } }
/** * Return immutable variant of this ClassElementValueGen */ @Override public ElementValue getElementValue() { return new ClassElementValue(super.getElementValueType(), idx, getConstantPool().getConstantPool()); }
private void setValue( final int index ) { final ConstantPool cp = super.getConstantPool().getConstantPool(); final Constant c = cp.getConstant(index); value = ((ConstantObject) c).getConstantValue(cp); }
/** * Retrieve an immutable version of this AnnotationGen */ public AnnotationEntry getAnnotation() { final AnnotationEntry a = new AnnotationEntry(typeIndex, cpool.getConstantPool(), isRuntimeVisible); for (final ElementValuePairGen element : evs) { a.addElementNameValuePair(element.getElementNameValuePair()); } return a; }
@Override public Type getType( final ConstantPoolGen cpg ) { switch (cpg.getConstantPool().getConstant(super.getIndex()).getTag()) { case org.apache.bcel.Const.CONSTANT_Long: return Type.LONG; case org.apache.bcel.Const.CONSTANT_Double: return Type.DOUBLE; default: // Never reached throw new RuntimeException("Unknown constant type " + super.getOpcode()); } }
/** * Override the parent method because our classname is held elsewhere. */ @Override public String getClassName( final ConstantPoolGen cpg ) { final ConstantPool cp = cpg.getConstantPool(); final ConstantInvokeDynamic cid = (ConstantInvokeDynamic) cp.getConstant(super.getIndex(), Const.CONSTANT_InvokeDynamic); return ((ConstantNameAndType) cp.getConstant(cid.getNameAndTypeIndex())).getName(cp); }
/** @return name of referenced method/field. */ public String getName( final ConstantPoolGen cpg ) { final ConstantPool cp = cpg.getConstantPool(); final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex()); return ((ConstantUtf8) cp.getConstant(cnat.getNameIndex())).getBytes(); }