Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.Attribute


     * @return generics signature (<code>null</code> if none)
     */
    public String getGenericsSignature() {
        Attribute[] attrs = m_item.getAttributes();
        for (int j = 0; j < attrs.length; j++) {
            Attribute attr = attrs[j];
            if (attr.getTag() == SIGNATURE_ATTRIBUTE_TAG) {
                return attr.toString();
            }
        }
        return null;
    }
View Full Code Here


            System.out.println( "Changed " + oldConst.toString() + " to " + newConst.toString() );
            retval = false;
          }
        }
        // Attributes
        Attribute newAttributes[] = nf.getAttributes();
        Attribute oldAttributes[] = of.getAttributes();
        int oldAttributesLength = oldAttributes.length;
        if( oldAttributesLength != newAttributes.length ) {
          System.out.println( "Number of field attributes changend (old: " + oldAttributesLength + " new: " + newAttributes.length + ")" );
          retval = false;
        }
        else {
          for( int j = 0; j < oldAttributesLength; j++ ) {
            Attribute oldAttr = oldAttributes[j];
            Attribute newAttr = newAttributes[j];
          }
        }
      }
    }
    return retval;
View Full Code Here

            System.out.println( "Changed " + oldConst.toString() + " to " + newConst.toString() );
            retval = false;
          }
        }
        // Attributes
        Attribute newAttributes[] = nf.getAttributes();
        Attribute oldAttributes[] = of.getAttributes();
        int oldAttributesLength = oldAttributes.length;
        if( oldAttributesLength != newAttributes.length ) {
          System.out.println( "Number of field attributes changend (old: " + oldAttributesLength + " new: " + newAttributes.length + ")" );
          retval = false;
        }
        else {
          for( int j = 0; j < oldAttributesLength; j++ ) {
            Attribute oldAttr = oldAttributes[j];
            Attribute newAttr = newAttributes[j];
          }
        }
      }
    }
    return retval;
View Full Code Here

                ((m.getAccessFlags() & (Constants.ACC_ABSTRACT | Constants.ACC_NATIVE)) == 0)
                        ? new InstructionList(m.getCode().getCode())
                        : null, cp);
        Attribute[] attributes = m.getAttributes();
        for (int i = 0; i < attributes.length; i++) {
            Attribute a = attributes[i];
            if (a instanceof Code) {
                Code c = (Code) a;
                setMaxStack(c.getMaxStack());
                setMaxLocals(c.getMaxLocals());
                CodeException[] ces = c.getExceptionTable();
View Full Code Here

        Code code = null;
        if ((il != null) && !isAbstract() && !isNative()) {
            // Remove any stale code attribute
            Attribute[] attributes = getAttributes();
            for (int i = 0; i < attributes.length; i++) {
                Attribute a = attributes[i];
                if (a instanceof Code) {
                    removeAttribute(a);
                }
            }
            code = new Code(cp.addUtf8("Code"), 8 + byte_code.length + // prologue byte code
View Full Code Here

    {
        int index = constantPoolGen.addUtf8("Synthetic");
        Synthetic syn =
            new Synthetic(index, 0, new byte[] { Constants.ATTR_SYNTHETIC }, m.getConstantPool());

        Attribute originalAttrs[] = m.getAttributes();
        Attribute attrs[];
        if ((originalAttrs == null) || (originalAttrs.length == 0))
        {
            attrs = new Attribute[] { syn };
        }
        else
View Full Code Here

    {
        if (m == null)
        {
            return false;
        }
        Attribute attrs[] = m.getAttributes();
        return isSynthetic(attrs);
     }
View Full Code Here

        {
            result = false;
        }
        for (int i = 0; i < attrs.length; i++)
        {
            Attribute a = attrs[i];
            // Constant c = m.getConstantPool().getConstant(a.getNameIndex());
            // if(c instanceof ConstantUtf8)
            if (a instanceof Synthetic)
            {
                result = true;
View Full Code Here

     * @return
     */
    private static List readAjAttributes(final Attribute[] attrs, final ISourceContext context) {
        List ajAttrs = new ArrayList();
        for (int i = attrs.length - 1; i >= 0; i--) {
            Attribute a = attrs[i];
            if (a instanceof Unknown) {
                Unknown u = (Unknown) a;
                String name = u.getName();
                if (name.startsWith(AjAttribute.AttributePrefix)) {
                    ajAttrs.add(AjAttribute.read(name, u.getBytes(), context));
View Full Code Here

    public void insertClassAttribute(final Object attribute) {
        if (m_classGen == null) {
            throw new IllegalStateException("attribute enhancer is not initialized");
        }
        byte[] serializedAttribute = serialize(attribute);
        Attribute attr = new Unknown(
                m_constantPoolGen.addUtf8(ATTRIBUTE_TYPE),
                serializedAttribute.length,
                serializedAttribute,
                m_constantPoolGen.getConstantPool()
        );
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.Attribute

Copyright © 2018 www.massapicom. 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.