/** * Constructs an <code>attribute_info</code> structure. * * @param cp constant pool table * @param attrname attribute name * @param attrinfo <code>info</code> field * of <code>attribute_info</code> structure. */ public AttributeInfo(ConstPool cp, String attrname, byte[] attrinfo) { this(cp, cp.addUtf8Info(attrname), attrinfo); }
/** * Sets the value of the member. */ public void setValue(String newValue) { valueIndex = cp.addUtf8Info(newValue); }
/** * Changes the name of the enum constant value. */ public void setValue(String name) { valueIndex = cp.addUtf8Info(name); }
/** * Sets the field name. */ public void setName(String newName) { name = constPool.addUtf8Info(newName); cachedName = newName; }
/** * Adds a new <code>CONSTANT_NameAndType_info</code> structure. * * <p>This also adds <code>CONSTANT_Utf8_info</code> structures. * * @param name <code>name_index</code> * @param type <code>descriptor_index</code> * @return the index of the added entry. */ public int addNameAndTypeInfo(String name, String type) { return addNameAndTypeInfo(addUtf8Info(name), addUtf8Info(type)); }
public void renameClass(ConstPool cp, Map map, HashMap cache) { String type = cp.getUtf8Info(typeDescriptor); String type2 = Descriptor.rename(type, map); if (type != type2) if (cache == null) typeDescriptor = cp.addUtf8Info(type2); else { cache.remove(this); typeDescriptor = cp.addUtf8Info(type2); cache.put(this, this); } }
public void renameClass(ConstPool cp, Map map, HashMap cache) { String desc = cp.getUtf8Info(descriptor); String desc2 = Descriptor.rename(desc, map); if (desc != desc2) if (cache == null) descriptor = cp.addUtf8Info(desc2); else { cache.remove(this); descriptor = cp.addUtf8Info(desc2); cache.put(this, this); } }
/** * Sets the field descriptor. * * @see Descriptor */ public void setDescriptor(String desc) { if (!desc.equals(getDescriptor())) descriptor = constPool.addUtf8Info(desc); }
/** * Writes an element of a <code>element_value_pairs</code> array * in <code>annotation</code>. * This method must be followed by a * call to <code>constValueIndex()</code>, <code>enumConstValue()</code>, * etc. * * @param memberName the element name. */ public void memberValuePair(String memberName) throws IOException { memberValuePair(pool.addUtf8Info(memberName)); }
public void renameClass(ConstPool cp, String oldName, String newName, HashMap cache) { String type = cp.getUtf8Info(typeDescriptor); String type2 = Descriptor.rename(type, oldName, newName); if (type != type2) if (cache == null) typeDescriptor = cp.addUtf8Info(type2); else { cache.remove(this); typeDescriptor = cp.addUtf8Info(type2); cache.put(this, this); } }
public void renameClass(ConstPool cp, String oldName, String newName, HashMap cache) { String desc = cp.getUtf8Info(descriptor); String desc2 = Descriptor.rename(desc, oldName, newName); if (desc != desc2) if (cache == null) descriptor = cp.addUtf8Info(desc2); else { cache.remove(this); descriptor = cp.addUtf8Info(desc2); cache.put(this, this); } }
/** * Sets a method descriptor. * * @see Descriptor */ public void setDescriptor(String desc) { if (!desc.equals(getDescriptor())) descriptor = constPool.addUtf8Info(desc); }
/** * Constructs an annotation including no members. A member can be * later added to the created annotation by <code>addMemberValue()</code>. * * @param typeName the fully-qualified name of the annotation interface type. * @param cp the constant pool table. * * @see #addMemberValue(String, MemberValue) */ public Annotation(String typeName, ConstPool cp) { this(cp.addUtf8Info(Descriptor.of(typeName)), cp); }
/** * Writes <code>tag</code> and <code>const_value_index</code> * in <code>element_value</code>. * * @param value the constant value. */ public void constValueIndex(String value) throws IOException { constValueIndex('s', pool.addUtf8Info(value)); }
/** * Writes <code>tag</code> and <code>class_info_index</code> * in <code>element_value</code>. * * @param name the class name. */ public void classInfoIndex(String name) throws IOException { classInfoIndex(pool.addUtf8Info(name)); }
/** * Sets <code>signature_index</code> to the index of the given generic signature, * which is added to a constant pool. * * @param sig new signature. * @since 3.11 */ public void setSignature(String sig) { int index = getConstPool().addUtf8Info(sig); ByteArray.write16bit(index, info, 0); }
public int copy(ConstPool src, ConstPool dest, Map map) { String mname = src.getUtf8Info(memberName); String tdesc = src.getUtf8Info(typeDescriptor); tdesc = Descriptor.rename(tdesc, map); return dest.addNameAndTypeInfo(dest.addUtf8Info(mname), dest.addUtf8Info(tdesc)); }
private void renameType(int pos, int index) { String name = cpool.getUtf8Info(index); String newName = Descriptor.rename(name, classnames); if (!name.equals(newName)) { int index2 = cpool.addUtf8Info(newName); ByteArray.write16bit(index2, info, pos); } } }
private int computeMethodref(int typedesc, ConstPool cp) { int classIndex = cp.addClassInfo(trapClass); int mnameIndex = cp.addUtf8Info(trapMethod); typedesc = cp.addUtf8Info( Descriptor.changeReturnType(classname, cp.getUtf8Info(typedesc))); return cp.addMethodrefInfo(classIndex, cp.addNameAndTypeInfo(mnameIndex, typedesc)); } }
public int copy(ConstPool src, ConstPool dest, Map map) { String desc = src.getUtf8Info(descriptor); desc = Descriptor.rename(desc, map); return dest.addMethodTypeInfo(dest.addUtf8Info(desc)); }