@@ -185,7 +185,7 @@ public class AjBuildManager { | |||
/** init only on initial batch compile? no file-specific options */ | |||
private void initBcelWorld(IMessageHandler handler) throws IOException { | |||
bcelWorld = new BcelWorld(buildConfig.getClasspath(), handler); | |||
bcelWorld = new BcelWorld(buildConfig.getClasspath(), handler, null); | |||
bcelWorld.setXnoInline(buildConfig.isXnoInline()); | |||
bcelWeaver = new BcelWeaver(bcelWorld); | |||
@@ -15,6 +15,7 @@ package org.aspectj.weaver; | |||
import java.util.*; | |||
import org.aspectj.asm.IRelationship; | |||
import org.aspectj.bridge.*; | |||
import org.aspectj.weaver.patterns.*; | |||
@@ -54,7 +55,13 @@ public class Checker extends ShadowMunger { | |||
new ISourceLocation[]{this.getSourceLocation()}); | |||
world.getMessageHandler().handleMessage(message); | |||
AsmRelationshipProvider.checkerMunger(world.getModel(), shadow, this); | |||
if (world.xrefHandler != null) { | |||
world.xrefHandler.addCrossReference(this.getSourceLocation(),shadow.getSourceLocation(),IRelationship.Kind.DECLARE); | |||
} | |||
if (world.getModel() != null) { | |||
AsmRelationshipProvider.checkerMunger(world.getModel(), shadow, this); | |||
} | |||
} | |||
return false; | |||
} |
@@ -0,0 +1,25 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2000, 2003 IBM Corporation and others. | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Common Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/cpl-v10.html | |||
* | |||
* Contributors: | |||
* IBM Corporation - initial API and implementation | |||
*******************************************************************************/ | |||
package org.aspectj.weaver; | |||
import org.aspectj.asm.IRelationship; | |||
import org.aspectj.bridge.ISourceLocation; | |||
/** | |||
* Clients can pass a single cross-reference handler to the weaver on construction | |||
* of a BcelWorld. Any cross-references detected during munging will be notified | |||
* to the handler. | |||
*/ | |||
public interface ICrossReferenceHandler { | |||
void addCrossReference(ISourceLocation from, ISourceLocation to, IRelationship.Kind kind); | |||
} |
@@ -19,6 +19,7 @@ import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.aspectj.asm.IRelationship; | |||
import org.aspectj.bridge.*; | |||
import org.aspectj.bridge.MessageUtil; | |||
import org.aspectj.lang.JoinPoint; | |||
@@ -338,6 +339,11 @@ public abstract class Shadow { | |||
for (Iterator iter = mungers.iterator(); iter.hasNext();) { | |||
ShadowMunger munger = (ShadowMunger) iter.next(); | |||
munger.implementOn(this); | |||
if (world.xrefHandler != null) { | |||
world.xrefHandler.addCrossReference(munger.getSourceLocation(),this.getSourceLocation(),IRelationship.Kind.ADVICE); | |||
} | |||
if (world.getModel() != null) { | |||
//System.err.println("munger: " + munger + " on " + this); | |||
AsmRelationshipProvider.adviceMunger(world.getModel(), this, munger); |
@@ -30,6 +30,7 @@ import org.aspectj.weaver.patterns.Pointcut; | |||
public abstract class World { | |||
protected IMessageHandler messageHandler = IMessageHandler.SYSTEM_ERR; | |||
protected ICrossReferenceHandler xrefHandler = null; | |||
protected Map typeMap = new HashMap(); // Signature to ResolvedType | |||
@@ -241,6 +242,10 @@ public abstract class World { | |||
this.messageHandler = messageHandler; | |||
} | |||
public void setXRefHandler(ICrossReferenceHandler xrefHandler) { | |||
this.xrefHandler = xrefHandler; | |||
} | |||
public void showMessage( | |||
Kind kind, | |||
String message, |
@@ -38,6 +38,7 @@ import org.aspectj.weaver.Advice; | |||
import org.aspectj.weaver.AdviceKind; | |||
import org.aspectj.weaver.AjAttribute; | |||
import org.aspectj.weaver.ConcreteTypeMunger; | |||
import org.aspectj.weaver.ICrossReferenceHandler; | |||
import org.aspectj.weaver.Member; | |||
import org.aspectj.weaver.ResolvedMember; | |||
import org.aspectj.weaver.ResolvedTypeMunger; | |||
@@ -61,7 +62,7 @@ public class BcelWorld extends World { | |||
} | |||
public BcelWorld(String cp) { | |||
this(makeDefaultClasspath(cp), IMessageHandler.THROW); | |||
this(makeDefaultClasspath(cp), IMessageHandler.THROW, null); | |||
} | |||
private static List makeDefaultClasspath(String cp) { | |||
@@ -82,10 +83,11 @@ public class BcelWorld extends World { | |||
return ret; | |||
} | |||
public BcelWorld(List classPath, IMessageHandler handler) { | |||
public BcelWorld(List classPath, IMessageHandler handler, ICrossReferenceHandler xrefHandler) { | |||
//this.aspectPath = new ClassPathManager(aspectPath, handler); | |||
this.classPath = new ClassPathManager(classPath, handler); | |||
setMessageHandler(handler); | |||
setXRefHandler(xrefHandler); | |||
} | |||
public void addPath (String name) { |