Package org.aspectj.weaver

Examples of org.aspectj.weaver.WeaverStateInfo


    // if is java 6 class file
    if (myGen.getMajor() >= Constants.MAJOR_1_6 && world.shouldGenerateStackMaps() && AsmDetector.isAsmAround) {
      wovenClassFileData = StackMapAdder.addStackMaps(world, wovenClassFileData);
    }

    WeaverStateInfo wsi = myType.getWeaverState();// getOrCreateWeaverStateInfo
    // ();
    if (wsi != null && wsi.isReweavable()) { // && !reweavableDataInserted
      // reweavableDataInserted = true;
      return wsi.replaceKeyWithDiff(wovenClassFileData);
    } else {
      return wovenClassFileData;
    }
  }
View Full Code Here


    }
    return myType.getWeaverState().getAspectsAffectingType();
  }

  public WeaverStateInfo getOrCreateWeaverStateInfo(boolean inReweavableMode) {
    WeaverStateInfo ret = myType.getWeaverState();
    if (ret != null) {
      return ret;
    }
    ret = new WeaverStateInfo(inReweavableMode);
    myType.setWeaverState(ret);
    return ret;
  }
View Full Code Here

          clazz.getOrCreateWeaverStateInfo(inReweavableMode);
      weaveInAddedMethods(); // FIXME asc are these potentially affected by declare annotation?
        }
       
        if (inReweavableMode) {
          WeaverStateInfo wsi = clazz.getOrCreateWeaverStateInfo(true);
          wsi.addAspectsAffectingType(aspectsAffectingType);
          wsi.setUnwovenClassFileData(ty.getJavaClass().getBytes());
          wsi.setReweavable(true);
        } else {
          clazz.getOrCreateWeaverStateInfo(false).setReweavable(false);
        }
       
        return isChanged;
View Full Code Here

      //System.out.println("type: " + type + " for " + aspectName);
    if (type.isAspect()) {
     
      // Bug 119657 ensure we use the unwoven aspect
      WeaverStateInfo wsi = type.getWeaverState();   
      if (wsi != null && wsi.isReweavable()) {
          BcelObjectType classType = getClassType(type.getName());
        classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes())));
      }
     
            //TODO AV - happens to reach that a lot of time: for each type flagged reweavable X for each aspect in the weaverstate
            //=> mainly for nothing for LTW - pbly for something in incremental build...
      xcutSet.addOrReplaceAspect(type);
View Full Code Here

          null, null);
    }
   
    public void processReweavableStateIfPresent(String className, BcelObjectType classType) {
    // If the class is marked reweavable, check any aspects around when it was built are in this world
    WeaverStateInfo wsi = classType.getWeaverState();   
    if (wsi!=null && wsi.isReweavable()) { // Check all necessary types are around!
      world.showMessage(IMessage.INFO,
          WeaverMessages.format(WeaverMessages.PROCESSING_REWEAVABLE,className,classType.getSourceLocation().getSourceFile()),
          null,null);
      Set aspectsPreviouslyInWorld = wsi.getAspectsAffectingType();
      if (aspectsPreviouslyInWorld!=null) {
                // keep track of them just to ensure unique missing aspect error reporting
                Set alreadyConfirmedReweavableState = new HashSet();
        for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) {
          String requiredTypeName = (String) iter.next();
          if (!alreadyConfirmedReweavableState.contains(requiredTypeName)) {
            ResolvedType rtx = world.resolve(UnresolvedType.forName(requiredTypeName),true);
            boolean exists = !rtx.isMissing();
            if (!exists) {
              world.showMessage(IMessage.ERROR,
                  WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE,requiredTypeName,className),
                    classType.getSourceLocation(), null);
            } else {
                            // weaved in aspect that are not declared in aop.xml trigger an error for now
                            // may cause headhache for LTW and packaged lib without aop.xml in
                            // see #104218
                            if(!xcutSet.containsAspect(rtx)){
                                world.showMessage(
                                        IMessage.ERROR,
                                        WeaverMessages.format(
                                                WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED,
                                                requiredTypeName,
                                                className
                                        ),
                                        null,
                                        null
                                );
                            } else if (!world.getMessageHandler().isIgnoring(IMessage.INFO))
                  world.showMessage(IMessage.INFO,
                    WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE,requiredTypeName,rtx.getSourceLocation().getSourceFile()),
                  null,null);
                  alreadyConfirmedReweavableState.add(requiredTypeName);
            }
          }   
        }
      }
      // old:
      //classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi.getUnwovenClassFileData()));
      // new: reweavable default with clever diff
      classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes())));
    } else {
      classType.resetState();
    }
  }
View Full Code Here

        } else {
      throw new RuntimeException("unimplemented");
    }
   
    if (changed && munger.changesPublicSignature()) {
      WeaverStateInfo info =
        weaver.getLazyClassGen().getOrCreateWeaverStateInfo(BcelClassWeaver.getReweavableMode());
      info.addConcreteMunger(this);
    }

    if (changed && worthReporting) {
      if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
          AsmRelationshipProvider.getDefault().addRelationship(weaver.getLazyClassGen().getType(), munger,getAspectType());
View Full Code Here

    }
   
    public byte [] getJavaClassBytesIncludingReweavable(BcelWorld world){
        writeBack(world);
        byte [] wovenClassFileData = myGen.getJavaClass().getBytes();
        WeaverStateInfo wsi = myType.getWeaverState();//getOrCreateWeaverStateInfo();
        if(wsi != null && wsi.isReweavable()){ // && !reweavableDataInserted
            //reweavableDataInserted = true;
            return wsi.replaceKeyWithDiff(wovenClassFileData);
        } else{
            return wovenClassFileData;
        }
    }
View Full Code Here

    if (myType.getWeaverState()==null) return null;
    return myType.getWeaverState().getAspectsAffectingType();
  }
   
  public WeaverStateInfo getOrCreateWeaverStateInfo(boolean inReweavableMode) {
    WeaverStateInfo ret = myType.getWeaverState();
    if (ret != null) return ret;
    ret = new WeaverStateInfo(inReweavableMode);
    myType.setWeaverState(ret);
    return ret;
  }
View Full Code Here

   
    // AMC we shouldn't need this when generic sigs are fixed??
    if (onType.isRawType()) onType = onType.getGenericType();

    WeaverStateInfo info = onType.getWeaverState();
   
    // this test isnt quite right - there will be a case where we fail to flag a problem
    // with a 'dangerous interface' because the type is reweavable when we should have
    // because the type wasn't going to be rewoven... if that happens, we should perhaps
    // move this test and dangerous interface processing to the end of this method and
    // make it conditional on whether any of the typeMungers passed into here actually
    // matched this type.
    if (info != null && !info.isOldStyle()   && !info.isReweavable()) {
      processTypeMungersFromExistingWeaverState(sourceType,onType);
      CompilationAndWeavingContext.leavingPhase(tok);
      return;
    }

    // Check if the type we are looking at is the topMostImplementor of a dangerous interface -
    // report a problem if it is.
    for (Iterator i = dangerousInterfaces.entrySet().iterator(); i.hasNext();) {
      Map.Entry entry = (Map.Entry) i.next();
      ResolvedType interfaceType = (ResolvedType)entry.getKey();
      if (onType.isTopmostImplementor(interfaceType)) {
        factory.showMessage(IMessage.ERROR,
          onType + ": " + entry.getValue(),
          onType.getSourceLocation(), null);
      }
    }
   
    boolean needOldStyleWarning = (info != null && info.isOldStyle());
   
    onType.clearInterTypeMungers();
   
    // FIXME asc perf Could optimize here, after processing the expected set of types we may bring
    // binary types that are not exposed to the weaver, there is no need to attempt declare parents
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.WeaverStateInfo

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.