/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { int index = getConstPool().copy(getConstantValue(), newCp, classnames); return new ConstantAttribute(newCp, index); } }
/** * Returns <code>constantvalue_index</code>. */ public int getConstantValue() { return ByteArray.readU16bit(get(), 0); }
/** * Constructs a ConstantValue attribute. * * @param cp a constant pool table. * @param index <code>constantvalue_index</code> * of <code>ConstantValue_attribute</code>. */ public ConstantAttribute(ConstPool cp, int index) { super(cp, tag); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
return new CodeAttribute(cp, name, in); else if (nameStr.equals(ConstantAttribute.tag)) return new ConstantAttribute(cp, name, in); else if (nameStr.equals(DeprecatedAttribute.tag)) return new DeprecatedAttribute(cp, name, in);
/** * Finds a ConstantValue attribute and returns the index into * the <code>constant_pool</code> table. * * @return 0 if a ConstantValue attribute is not found. */ public int getConstantValue() { if ((accessFlags & AccessFlag.STATIC) == 0) return 0; ConstantAttribute attr = (ConstantAttribute)getAttribute(ConstantAttribute.tag); if (attr == null) return 0; else return attr.getConstantValue(); }
if (index != 0) { index = constPool.copy(index, cp, null); newAttributes.add(new ConstantAttribute(cp, index));
/** * Finds a ConstantValue attribute and returns the index into * the <code>constant_pool</code> table. * * @return 0 if a ConstantValue attribute is not found. */ public int getConstantValue() { if ((accessFlags & AccessFlag.STATIC) == 0) return 0; ConstantAttribute attr = (ConstantAttribute)getAttribute(ConstantAttribute.tag); if (attr == null) return 0; return attr.getConstantValue(); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ @Override public AttributeInfo copy(ConstPool newCp, Map<String,String> classnames) { int index = getConstPool().copy(getConstantValue(), newCp, classnames); return new ConstantAttribute(newCp, index); } }
return new CodeAttribute(cp, name, in); else if (nameStr.equals(ConstantAttribute.tag)) return new ConstantAttribute(cp, name, in); else if (nameStr.equals(DeprecatedAttribute.tag)) return new DeprecatedAttribute(cp, name, in);
/** * Returns <code>constantvalue_index</code>. */ public int getConstantValue() { return ByteArray.readU16bit(get(), 0); }
/** * Constructs a ConstantValue attribute. * * @param cp a constant pool table. * @param index <code>constantvalue_index</code> * of <code>ConstantValue_attribute</code>. */ public ConstantAttribute(ConstPool cp, int index) { super(cp, tag); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
/** * Finds a ConstantValue attribute and returns the index into * the <code>constant_pool</code> table. * * @return 0 if a ConstantValue attribute is not found. */ public int getConstantValue() { if ((accessFlags & AccessFlag.STATIC) == 0) return 0; ConstantAttribute attr = (ConstantAttribute)getAttribute(ConstantAttribute.tag); if (attr == null) return 0; else return attr.getConstantValue(); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { int index = getConstPool().copy(getConstantValue(), newCp, classnames); return new ConstantAttribute(newCp, index); } }
void prune(ConstPool cp) { List<AttributeInfo> newAttributes = new ArrayList<AttributeInfo>(); AttributeInfo invisibleAnnotations = getAttribute(AnnotationsAttribute.invisibleTag); if (invisibleAnnotations != null) { invisibleAnnotations = invisibleAnnotations.copy(cp, null); newAttributes.add(invisibleAnnotations); } AttributeInfo visibleAnnotations = getAttribute(AnnotationsAttribute.visibleTag); if (visibleAnnotations != null) { visibleAnnotations = visibleAnnotations.copy(cp, null); newAttributes.add(visibleAnnotations); } AttributeInfo signature = getAttribute(SignatureAttribute.tag); if (signature != null) { signature = signature.copy(cp, null); newAttributes.add(signature); } int index = getConstantValue(); if (index != 0) { index = constPool.copy(index, cp, null); newAttributes.add(new ConstantAttribute(cp, index)); } attribute = newAttributes; name = cp.addUtf8Info(getName()); descriptor = cp.addUtf8Info(getDescriptor()); constPool = cp; }
/** * Returns <code>constantvalue_index</code>. */ public int getConstantValue() { return ByteArray.readU16bit(get(), 0); }
/** * Constructs a ConstantValue attribute. * * @param cp a constant pool table. * @param index <code>constantvalue_index</code> * of <code>ConstantValue_attribute</code>. */ public ConstantAttribute(ConstPool cp, int index) { super(cp, tag); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
/** * Finds a ConstantValue attribute and returns the index into * the <code>constant_pool</code> table. * * @return 0 if a ConstantValue attribute is not found. */ public int getConstantValue() { if ((accessFlags & AccessFlag.STATIC) == 0) return 0; ConstantAttribute attr = (ConstantAttribute)getAttribute(ConstantAttribute.tag); if (attr == null) return 0; else return attr.getConstantValue(); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { int index = getConstPool().copy(getConstantValue(), newCp, classnames); return new ConstantAttribute(newCp, index); } }
int index = init.getConstantValue(cp, f.getType()); if (index != 0) { f.getFieldInfo2().addAttribute(new ConstantAttribute(cp, index)); init = null;
/** * Returns <code>constantvalue_index</code>. */ public int getConstantValue() { return ByteArray.readU16bit(get(), 0); }