Package org.aspectj.weaver.AjAttribute

Examples of org.aspectj.weaver.AjAttribute.WeaverVersionInfo


    AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
    Attribute[] attributes = javaClass.getAttributes();
    boolean hasAtAspectAnnotation = false;
    boolean hasAtPrecedenceAnnotation = false;

    WeaverVersionInfo wvinfo = null;
    for (int i = 0; i < attributes.length; i++) {
      Attribute attribute = attributes[i];
      if (acceptAttribute(attribute)) {
        RuntimeAnnos rvs = (RuntimeAnnos) attribute;
        // we don't need to look for several attribute occurrences since
        // it cannot happen as per JSR175
        if (!isCodeStyleAspect && !javaClass.isInterface()) {
          hasAtAspectAnnotation = handleAspectAnnotation(rvs, struct);
          // TODO AV - if put outside the if isCodeStyleAspect then we
          // would enable mix style
          hasAtPrecedenceAnnotation = handlePrecedenceAnnotation(rvs, struct);
        }
        // there can only be one RuntimeVisible bytecode attribute
        break;
      }
    }
    for (int i = attributes.length - 1; i >= 0; i--) {
      Attribute attribute = attributes[i];
      if (attribute.getName().equals(WeaverVersionInfo.AttributeName)) {
        try {
          VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(
              ((Unknown) attribute).getBytes()), null);
          wvinfo = WeaverVersionInfo.read(s);
          struct.ajAttributes.add(0, wvinfo);
        } catch (IOException ioe) {
          ioe.printStackTrace();
        }
      }
    }
    if (wvinfo == null) {
      // If we are in here due to a resetState() call (presumably because of reweavable state processing), the
      // original type delegate will have been set with a version but that version will be missing from
      // the new set of attributes (looks like a bug where the version attribute was not included in the
      // data compressed into the attribute). So rather than 'defaulting' to current, we should use one
      // if it set on the delegate for the type.
      ReferenceTypeDelegate delegate = type.getDelegate();
      if (delegate instanceof BcelObjectType) {
        wvinfo = ((BcelObjectType) delegate).getWeaverVersionAttribute();
        if (wvinfo != null) {
          if (wvinfo.getMajorVersion() != WeaverVersionInfo.WEAVER_VERSION_MAJOR_UNKNOWN) {
            // use this one
            struct.ajAttributes.add(0, wvinfo);
          } else {
            wvinfo = null;
          }
View Full Code Here


      // classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass
      // ().getFileName(), wsi.getUnwovenClassFileData()));
      // new: reweavable default with clever diff
      if (!world.isOverWeaving()) {
        byte[] bytes = wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes());
        WeaverVersionInfo wvi = classType.getWeaverVersionAttribute();
        JavaClass newJavaClass = Utility.makeJavaClass(classType.getJavaClass().getFileName(), bytes);
        classType.setJavaClass(newJavaClass, true);
        classType.getResolvedTypeX().ensureConsistent();
      }
      // } else {
View Full Code Here

  // =============================

  @Override
  public String toString() {
    BcelObjectType bot = enclosingClass.getBcelObjectType();
    WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
    return toLongString(weaverVersion);
  }
View Full Code Here

    AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
    Attribute[] attributes = javaClass.getAttributes();
    boolean hasAtAspectAnnotation = false;
    boolean hasAtPrecedenceAnnotation = false;

    WeaverVersionInfo wvinfo = null;
    for (int i = 0; i < attributes.length; i++) {
      Attribute attribute = attributes[i];
      if (acceptAttribute(attribute)) {
        RuntimeAnnos rvs = (RuntimeAnnos) attribute;
        // we don't need to look for several attribute occurrences since
        // it cannot happen as per JSR175
        if (!isCodeStyleAspect && !javaClass.isInterface()) {
          hasAtAspectAnnotation = handleAspectAnnotation(rvs, struct);
          // TODO AV - if put outside the if isCodeStyleAspect then we
          // would enable mix style
          hasAtPrecedenceAnnotation = handlePrecedenceAnnotation(rvs, struct);
        }
        // there can only be one RuntimeVisible bytecode attribute
        break;
      }
    }
    for (int i = attributes.length - 1; i >= 0; i--) {
      Attribute attribute = attributes[i];
      if (attribute.getName().equals(WeaverVersionInfo.AttributeName)) {
        try {
          VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(
              ((Unknown) attribute).getBytes()), null);
          wvinfo = WeaverVersionInfo.read(s);
          struct.ajAttributes.add(0, wvinfo);
        } catch (IOException ioe) {
          ioe.printStackTrace();
        }
      }
    }
    if (wvinfo == null) {
      // If we are in here due to a resetState() call (presumably because of reweavable state processing), the
      // original type delegate will have been set with a version but that version will be missing from
      // the new set of attributes (looks like a bug where the version attribute was not included in the
      // data compressed into the attribute). So rather than 'defaulting' to current, we should use one
      // if it set on the delegate for the type.
      ReferenceTypeDelegate delegate = type.getDelegate();
      if (delegate instanceof BcelObjectType) {
        wvinfo = ((BcelObjectType) delegate).getWeaverVersionAttribute();
        if (wvinfo != null) {
          if (wvinfo.getMajorVersion() != WeaverVersionInfo.WEAVER_VERSION_MAJOR_UNKNOWN) {
            // use this one
            struct.ajAttributes.add(0, wvinfo);
          } else {
            wvinfo = null;
          }
View Full Code Here

  }

  private void unpackAjAttributes(World world) {
    associatedShadowMunger = null;
    ResolvedType resolvedDeclaringType = getDeclaringType().resolve(world);
    WeaverVersionInfo wvinfo = bcelObjectType.getWeaverVersionAttribute();
    List<AjAttribute> as = Utility.readAjAttributes(resolvedDeclaringType.getClassName(), method.getAttributes(),
        resolvedDeclaringType.getSourceContext(), world, wvinfo, new BcelConstantPoolReader(method.getConstantPool()));
    processAttributes(world, as);
    as = AtAjAttributes.readAj5MethodAttributes(method, this, resolvedDeclaringType, preResolvedPointcut,
        resolvedDeclaringType.getSourceContext(), world.getMessageHandler());
View Full Code Here

      // classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass
      // ().getFileName(), wsi.getUnwovenClassFileData()));
      // new: reweavable default with clever diff
      if (!world.isOverWeaving()) {
        byte[] bytes = wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes());
        WeaverVersionInfo wvi = classType.getWeaverVersionAttribute();
        JavaClass newJavaClass = Utility.makeJavaClass(classType.getJavaClass().getFileName(), bytes);
        classType.setJavaClass(newJavaClass, true);
        classType.getResolvedTypeX().ensureConsistent();
      }
      // } else {
View Full Code Here

  // =============================

  @Override
  public String toString() {
    BcelObjectType bot = enclosingClass.getBcelObjectType();
    WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
    return toLongString(weaverVersion);
  }
View Full Code Here

  // =============================

  @Override
  public String toString() {
    BcelObjectType bot = enclosingClass.getBcelObjectType();
    WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
    return toLongString(weaverVersion);
  }
View Full Code Here

    }
   
    // =============================

  public String toString() {
    WeaverVersionInfo weaverVersion = enclosingClass.getBcelObjectType().getWeaverVersionAttribute();
    return toLongString(weaverVersion);
  }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.AjAttribute.WeaverVersionInfo

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.