/**
   * @return whether or not that was a change to the global signature XXX for efficiency we will
   *     need a richer representation than this
   */
  public boolean addOrReplaceAspect(ResolvedType aspectType, boolean inWeavingPhase) {
    trace.enter("addOrReplaceAspect", this, new Object[] {aspectType, new Boolean(inWeavingPhase)});

    boolean change = false;
    CrosscuttingMembers xcut = (CrosscuttingMembers) members.get(aspectType);
    if (xcut == null) {
      members.put(aspectType, aspectType.collectCrosscuttingMembers(inWeavingPhase));
      clearCaches();
      CflowPointcut.clearCaches(aspectType);
      change = true;
    } else {
      if (xcut.replaceWith(aspectType.collectCrosscuttingMembers(inWeavingPhase), inWeavingPhase)) {
        clearCaches();

        CflowPointcut.clearCaches(aspectType);
        change = true;
      } else {
        if (!AsmManager.getDefault().getHandleProvider().dependsOnLocation() && inWeavingPhase) {
          // bug 134541 - even though we haven't changed we may have updated the
          // sourcelocation for the shadowMunger which we need to pick up
          shadowMungers = null;
        }
        change = false;
      }
    }
    if (aspectType.isAbstract()) {
      // we might have sub-aspects that need to re-collect their crosscutting members from us
      boolean ancestorChange = addOrReplaceDescendantsOf(aspectType, inWeavingPhase);
      change = change || ancestorChange;
    }
    changedSinceLastReset = changedSinceLastReset || change;

    trace.exit("addOrReplaceAspect", change);
    return change;
  }
Пример #2
0
 /* (non-Javadoc)
  * @see junit.framework.TestCase#setUp()
  */
 protected void setUp() throws Exception {
   super.setUp();
   // using the JDTLikeHandleProvider because this produces consistent handles
   // over different compiles
   handleProvider = AsmManager.getDefault().getHandleProvider();
   AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
   // We are about to create a sandbox for the model output file, don't let the
   // following compile wipe it.
   ajc.setShouldEmptySandbox(false);
   // report all information - model, relationships delta processing
   modelFilename = ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "model.txt";
   AsmManager.setReporting(
       modelFilename,
       true,
       true,
       true,
       false,
       new TestFilter(ajc.getSandboxDirectory().getCanonicalPath()));
 }
Пример #3
0
 /* (non-Javadoc)
  * @see junit.framework.TestCase#tearDown()
  */
 protected void tearDown() throws Exception {
   super.tearDown();
   AsmManager.getDefault().setHandleProvider(handleProvider);
   AsmManager.setDontReport();
   ajc.setShouldEmptySandbox(true);
 }