summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-16 14:54:03 +0000
committermwebster <mwebster>2006-08-16 14:54:03 +0000
commit4ce6cb8b0cd79d8ba746473af86a76774755b6b8 (patch)
tree417784193fe8c858af3a8059449da13f66f3de27
parentc1c9215efa1c1e332859dd50c103e2a0021e15fe (diff)
downloadaspectj-4ce6cb8b0cd79d8ba746473af86a76774755b6b8.tar.gz
aspectj-4ce6cb8b0cd79d8ba746473af86a76774755b6b8.zip
Bug 150487 "Tracing and Logging Framework" (new/fixed trace points)
-rw-r--r--loadtime/src/org/aspectj/weaver/loadtime/Aj.java19
-rw-r--r--weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java12
-rw-r--r--weaver/src/org/aspectj/weaver/UnresolvedType.java7
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java4
4 files changed, 32 insertions, 10 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java
index 97dbd4d82..f7afb1c6f 100644
--- a/loadtime/src/org/aspectj/weaver/loadtime/Aj.java
+++ b/loadtime/src/org/aspectj/weaver/loadtime/Aj.java
@@ -36,7 +36,7 @@ public class Aj implements ClassPreProcessor {
public Aj(IWeavingContext context){
- if (trace.isTraceEnabled()) trace.enter("<init>",this,new Object[] {context});
+ if (trace.isTraceEnabled()) trace.enter("<init>",this,new Object[] {context, getClass().getClassLoader()});
this.weavingContext = context;
if (trace.isTraceEnabled()) trace.exit("<init>");
}
@@ -57,15 +57,15 @@ public class Aj implements ClassPreProcessor {
* @return weaved bytes
*/
public byte[] preProcess(String className, byte[] bytes, ClassLoader loader) {
- if (trace.isTraceEnabled()) trace.enter("preProcess",this,new Object[] {className,bytes,loader});
//TODO AV needs to doc that
if (loader == null || className == null) {
// skip boot loader or null classes (hibernate)
- if (trace.isTraceEnabled()) trace.exit("preProcess",bytes);
return bytes;
}
+ if (trace.isTraceEnabled()) trace.enter("preProcess",this,new Object[] {className, bytes, loader, Thread.currentThread().getContextClassLoader()});
+
try {
synchronized (loader) {
WeavingAdaptor weavingAdaptor = WeaverContainer.getWeaver(loader, weavingContext);
@@ -73,15 +73,16 @@ public class Aj implements ClassPreProcessor {
if (trace.isTraceEnabled()) trace.exit("preProcess");
return bytes;
}
- if (trace.isTraceEnabled()) trace.exit("preProcess",bytes);
- return weavingAdaptor.weaveClass(className, bytes);
+ byte[] newBytes = weavingAdaptor.weaveClass(className, bytes);
+ if (trace.isTraceEnabled()) trace.exit("preProcess",newBytes);
+ return newBytes;
}
- } catch (Exception t) {
- trace.error("preProcess",t);
+ } catch (Exception ex) {
+ trace.error("preProcess",ex);
//FIXME AV wondering if we should have the option to fail (throw runtime exception) here
// would make sense at least in test f.e. see TestHelper.handleMessage()
- t.printStackTrace();
- if (trace.isTraceEnabled()) trace.exit("preProcess",bytes);
+ ex.printStackTrace();
+ if (trace.isTraceEnabled()) trace.exit("preProcess",ex);
return bytes;
}
}
diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
index b456c7d9d..55d46b642 100644
--- a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
+++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
@@ -25,6 +25,8 @@ import org.aspectj.asm.AsmManager;
import org.aspectj.weaver.patterns.CflowPointcut;
import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.IVerificationRequired;
+import org.aspectj.weaver.tools.Trace;
+import org.aspectj.weaver.tools.TraceFactory;
/**
* This holds on to all CrosscuttingMembers for a world. It handles
@@ -50,8 +52,14 @@ public class CrosscuttingMembersSet {
private List /*IVerificationRequired*/ verificationList = null; // List of things to be verified once the type system is 'complete'
+ private static Trace trace = TraceFactory.getTraceFactory().getTrace(CrosscuttingMembersSet.class);
+
public CrosscuttingMembersSet(World world) {
+ trace.enter("<init>",this,world);
+
this.world = world;
+
+ trace.exit("<init>");
}
public boolean addOrReplaceAspect(ResolvedType aspectType) {
@@ -63,6 +71,8 @@ public class CrosscuttingMembersSet {
* 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) {
@@ -92,6 +102,8 @@ public class CrosscuttingMembersSet {
change = change || ancestorChange;
}
changedSinceLastReset = changedSinceLastReset || change;
+
+ trace.exit("addOrReplaceAspect",change);
return change;
}
diff --git a/weaver/src/org/aspectj/weaver/UnresolvedType.java b/weaver/src/org/aspectj/weaver/UnresolvedType.java
index 49834e148..817a07e1d 100644
--- a/weaver/src/org/aspectj/weaver/UnresolvedType.java
+++ b/weaver/src/org/aspectj/weaver/UnresolvedType.java
@@ -22,6 +22,7 @@ import java.util.Map;
import org.aspectj.apache.bcel.classfile.GenericSignatureParser;
import org.aspectj.apache.bcel.classfile.Signature;
import org.aspectj.apache.bcel.classfile.Signature.ClassSignature;
+import org.aspectj.weaver.tools.Traceable;
/**
* A UnresolvedType represents a type to the weaver. It has a basic signature that knows
@@ -93,7 +94,7 @@ import org.aspectj.apache.bcel.classfile.Signature.ClassSignature;
* The wildcard ? extends Foo has signature +LFoo;
* The wildcard ? super Foo has signature -LFoo;
*/
-public class UnresolvedType implements TypeVariableDeclaringElement {
+public class UnresolvedType implements Traceable, TypeVariableDeclaringElement {
// common types referred to by the weaver
public static final UnresolvedType[] NONE = new UnresolvedType[0];
@@ -917,6 +918,10 @@ public class UnresolvedType implements TypeVariableDeclaringElement {
}
return null;
}
+
+ public String toTraceString() {
+ return getClass().getName() + "[" + getName() + "]";
+ }
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index feae53d0f..0a13be53d 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -1324,6 +1324,8 @@ public class BcelWeaver implements IWeaver {
private void weaveAndNotify(UnwovenClassFile classFile, BcelObjectType classType,
IWeaveRequestor requestor) throws IOException {
+ trace.enter("weaveAndNotify",this,new Object[] {classFile,classType,requestor});
+
ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_TYPE, classType.getResolvedTypeX().getName());
LazyClassGen clazz = weaveWithoutDump(classFile,classType);
classType.finishedWith();
@@ -1338,6 +1340,8 @@ public class BcelWeaver implements IWeaver {
}
classType.weavingCompleted();
CompilationAndWeavingContext.leavingPhase(tok);
+
+ trace.exit("weaveAndNotify");
}
/** helper method - will return NULL if the underlying delegate is an EclipseSourceType and not a BcelObjectType */