summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-26 15:05:01 +0000
committeracolyer <acolyer>2005-09-26 15:05:01 +0000
commitd485f9bcc4df37aef60863fceb88654bbd32b680 (patch)
tree1341f68a69f16d1a6b0f86d840ee8a5553c8d091 /org.aspectj.ajdt.core
parent4afdcf2612e94ce3c07ab0db5b20ea73134ac632 (diff)
downloadaspectj-d485f9bcc4df37aef60863fceb88654bbd32b680.tar.gz
aspectj-d485f9bcc4df37aef60863fceb88654bbd32b680.zip
fix for pr108123 and pr106500 - better diagnostics and exceptions, plus support for -Xdev:Pinpoint
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java25
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java6
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java7
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java37
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java63
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java38
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java13
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java1
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java2
13 files changed, 202 insertions, 14 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
index fd542eae3..929619c00 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
@@ -516,7 +516,9 @@ public class BuildArgParser extends Main {
buildConfig.setGenerateJavadocsInModelMode(true);
} else if (arg.equals("-Xdev:NoAtAspectJProcessing")) {
buildConfig.setNoAtAspectJAnnotationProcessing(true);
- }else if (arg.equals("-noweave") || arg.equals( "-XnoWeave")) {
+ } else if (arg.equals("-Xdev:Pinpoint")) {
+ buildConfig.setXdevPinpointMode(true);
+ } else if (arg.equals("-noweave") || arg.equals( "-XnoWeave")) {
buildConfig.setNoWeave(true);
} else if (arg.equals("-XserializableAspects")) {
buildConfig.setXserializableAspects(true);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java
index 9369f4bb7..ddc231bec 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java
@@ -25,6 +25,8 @@ import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IProgressListener;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.Compiler;
@@ -60,6 +62,11 @@ public class AjCompilerAdapter implements ICompilerAdapter {
private Map /* fileName |-> List<UnwovenClassFile> */ binarySourceSetForFullWeave = new HashMap();
private Collection /*InterimCompilationResult*/ resultSetForFullWeave = Collections.EMPTY_LIST;
+ private ContextToken processingToken = null;
+ private ContextToken resolvingToken = null;
+ private ContextToken analysingToken = null;
+ private ContextToken generatingToken = null;
+
List /*InterimResult*/ resultsPendingWeave = new ArrayList();
/**
@@ -122,22 +129,26 @@ public class AjCompilerAdapter implements ICompilerAdapter {
public void beforeProcessing(CompilationUnitDeclaration unit) {
eWorld.showMessage(IMessage.INFO, "compiling " + new String(unit.getFileName()), null, null);
+ processingToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_COMPILATION_UNIT,unit.getFileName());
if (inJava5Mode && !noAtAspectJAnnotationProcessing) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.ADDING_AT_ASPECTJ_ANNOTATIONS, unit.getFileName());
AddAtAspectJAnnotationsVisitor atAspectJVisitor = new AddAtAspectJAnnotationsVisitor(unit);
unit.traverse(atAspectJVisitor, unit.scope);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
}
public void beforeResolving(CompilationUnitDeclaration unit) {
- // no-op
+ resolvingToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.RESOLVING_COMPILATION_UNIT, unit.getFileName());
}
public void afterResolving(CompilationUnitDeclaration unit) {
- // no-op
-
+ if (resolvingToken != null)
+ CompilationAndWeavingContext.leavingPhase(resolvingToken);
}
public void beforeAnalysing(CompilationUnitDeclaration unit) {
+ analysingToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.ANALYSING_COMPILATION_UNIT, unit.getFileName());
if (inJava5Mode && !noAtAspectJAnnotationProcessing) {
ValidateAtAspectJAnnotationsVisitor atAspectJVisitor = new ValidateAtAspectJAnnotationsVisitor(unit);
unit.traverse(atAspectJVisitor, unit.scope);
@@ -145,15 +156,17 @@ public class AjCompilerAdapter implements ICompilerAdapter {
}
public void afterAnalysing(CompilationUnitDeclaration unit) {
- // no-op
+ if (analysingToken != null)
+ CompilationAndWeavingContext.leavingPhase(analysingToken);
}
public void beforeGenerating(CompilationUnitDeclaration unit) {
- // no-op
+ generatingToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.GENERATING_UNWOVEN_CODE_FOR_COMPILATION_UNIT, unit.getFileName());
}
public void afterGenerating(CompilationUnitDeclaration unit) {
- // no-op
+ if (generatingToken != null)
+ CompilationAndWeavingContext.leavingPhase(generatingToken);
}
public void afterCompiling(CompilationUnitDeclaration[] units) {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
index 98cb80d24..225ac7e0d 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
@@ -20,6 +20,8 @@ import java.util.List;
import org.aspectj.ajdt.internal.compiler.lookup.AjTypeConstants;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedHandler;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -166,7 +168,9 @@ public class AdviceDeclaration extends AjMethodDeclaration {
this.traverse(new MakeDeclsPublicVisitor(), (ClassScope)null);
AccessForInlineVisitor v = new AccessForInlineVisitor((AspectDeclaration)upperScope.referenceContext, handler);
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.ACCESS_FOR_INLINE, selector);
this.traverse(v, (ClassScope) null);
+ CompilationAndWeavingContext.leavingPhase(tok);
// ??? if we found a construct that we can't inline, set
// proceedInInners so that we won't try to inline this body
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
index d83161553..81c47a4d9 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
@@ -21,6 +21,8 @@ import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseTypeMunger;
import org.aspectj.ajdt.internal.compiler.lookup.InterTypeScope;
import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -138,10 +140,12 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
private void fixSuperCallsForInterfaceContext(ClassScope scope) {
if (onTypeBinding.isInterface()) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.FIXING_SUPER_CALLS, selector);
InterSuperFixerVisitor v =
new InterSuperFixerVisitor(this,
EclipseFactory.fromScopeLookupEnvironment(scope), scope);
this.traverse(v, scope);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
}
@@ -151,9 +155,11 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
public abstract EclipseTypeMunger build(ClassScope classScope);
public void fixSuperCallsInBody() {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.FIXING_SUPER_CALLS_IN_ITDS, selector);
SuperFixerVisitor v = new SuperFixerVisitor(this, onTypeBinding);
this.traverse(v, (ClassScope)null);
munger.setSuperMethodsCalled(v.superMethodsCalled);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
protected void resolveOnType(ClassScope classScope) {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java
index 5f51a4564..17bef539c 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java
@@ -14,6 +14,8 @@
package org.aspectj.ajdt.internal.compiler.ast;
import org.aspectj.weaver.Advice;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
@@ -135,6 +137,7 @@ public class ThisJoinPointVisitor extends ASTVisitor {
boolean inBlockThatCantRun = false;
public boolean visit(MessageSend call, BlockScope scope) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.OPTIMIZING_THIS_JOIN_POINT_CALLS, call.selector);
Expression receiver = call.receiver;
if (isRef(receiver, thisJoinPointDec)) {
if (canTreatAsStatic(new String(call.selector))) {
@@ -148,12 +151,15 @@ public class ThisJoinPointVisitor extends ASTVisitor {
for (int i = 0; i < argumentsLength; i++)
call.arguments[i].traverse(this, scope);
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
}
}
- return super.visit(call, scope);
+ boolean ret = super.visit(call, scope);
+ CompilationAndWeavingContext.leavingPhase(tok);
+ return ret;
}
private void replaceEffectivelyStaticRef(MessageSend call) {
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
index 2d1785797..4f0106fb6 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
@@ -17,6 +17,8 @@ import java.util.Stack;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseScope;
import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -109,6 +111,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
}
private void checkTypeDeclaration(TypeDeclaration typeDecl) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.VALIDATING_AT_ASPECTJ_ANNOTATIONS, typeDecl.name);
if (!(typeDecl instanceof AspectDeclaration)) {
if (ajAnnotations.hasAspectAnnotation) {
validateAspectDeclaration(typeDecl);
@@ -138,9 +141,11 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
);
}
}
+ CompilationAndWeavingContext.leavingPhase(tok);
}
public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.VALIDATING_AT_ASPECTJ_ANNOTATIONS, methodDeclaration.selector);
ajAnnotations = new AspectJAnnotations(methodDeclaration.annotations);
if (!methodDeclaration.getClass().equals(AjMethodDeclaration.class)) {
// simply test for innapropriate use of annotations on code-style members
@@ -171,6 +176,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
"@AspectJ annotations cannot be declared on this aspect member");
}
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
@@ -179,6 +185,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
} else if (ajAnnotations.hasPointcutAnnotation) {
convertToPointcutDeclaration(methodDeclaration,scope);
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 4b4ada030..5b64bd471 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -27,6 +27,8 @@ import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.WeaveMessage;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -91,22 +93,29 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
//??? duplicates some of super's code
public void completeTypeBindings() {
+ ContextToken completeTypeBindingsToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.COMPLETING_TYPE_BINDINGS, "");
// builtInterTypesAndPerClauses = false;
//pendingTypesToWeave = new ArrayList();
stepCompleted = BUILD_TYPE_HIERARCHY;
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.CHECK_AND_SET_IMPORTS, units[i].compilationResult.fileName);
units[i].scope.checkAndSetImports();
+ CompilationAndWeavingContext.leavingPhase(tok);
}
stepCompleted = CHECK_AND_SET_IMPORTS;
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.CONNECTING_TYPE_HIERARCHY, units[i].compilationResult.fileName);
units[i].scope.connectTypeHierarchy();
+ CompilationAndWeavingContext.leavingPhase(tok);
}
stepCompleted = CONNECT_TYPE_HIERARCHY;
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.BUILDING_FIELDS_AND_METHODS, units[i].compilationResult.fileName);
units[i].scope.buildFieldsAndMethods();
+ CompilationAndWeavingContext.leavingPhase(tok);
}
// would like to gather up all TypeDeclarations at this point and put them in the factory
@@ -190,14 +199,18 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
SourceTypeBinding[] b = units[i].scope.topLevelTypes;
for (int j = 0; j < b.length; j++) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.RESOLVING_POINTCUT_DECLARATIONS, b[j].sourceName);
resolvePointcutDeclarations(b[j].scope);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
}
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
SourceTypeBinding[] b = units[i].scope.topLevelTypes;
for (int j = 0; j < b.length; j++) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.ADDING_DECLARE_WARNINGS_AND_ERRORS, b[j].sourceName);
addAdviceLikeDeclares(b[j].scope);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
}
@@ -207,6 +220,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
stepCompleted = BUILD_FIELDS_AND_METHODS;
lastCompletedUnitIndex = lastUnitIndex;
+
+ CompilationAndWeavingContext.leavingPhase(completeTypeBindingsToken);
}
@@ -218,6 +233,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
*/
private void collectAllITDsAndDeclares(SourceTypeBinding sourceType, Collection yetToProcess) {
// Look at the supertype first
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.COLLECTING_ITDS_AND_DECLARES, sourceType.sourceName);
ReferenceBinding superType = sourceType.superclass();
if (yetToProcess.contains(superType) && superType instanceof SourceTypeBinding) {
collectAllITDsAndDeclares((SourceTypeBinding)superType, yetToProcess);
@@ -225,6 +241,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
buildInterTypeAndPerClause(sourceType.scope);
addCrosscuttingStructures(sourceType.scope);
yetToProcess.remove(sourceType);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
/**
@@ -259,7 +276,9 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
private void doPendingWeaves() {
for (Iterator i = pendingTypesToWeave.iterator(); i.hasNext(); ) {
SourceTypeBinding t = (SourceTypeBinding)i.next();
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_INTERTYPE_DECLARATIONS, t.sourceName);
weaveInterTypeDeclarations(t);
+ CompilationAndWeavingContext.leavingPhase(tok);
}
pendingTypesToWeave.clear();
}
@@ -397,6 +416,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
private void weaveInterTypeDeclarations(SourceTypeBinding sourceType, Collection typeMungers,
Collection declareParents, Collection declareAnnotationOnTypes, boolean skipInners) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_INTERTYPE_DECLARATIONS, sourceType.sourceName);
ResolvedType onType = factory.fromEclipse(sourceType);
// AMC we shouldn't need this when generic sigs are fixed??
if (onType.isRawType()) onType = onType.getGenericType();
@@ -423,7 +443,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
}
}
-
+ CompilationAndWeavingContext.leavingPhase(tok);
return;
}
@@ -556,9 +576,11 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
weaveInterTypeDeclarations((SourceTypeBinding) memberTypes[i], typeMungers, declareParents,declareAnnotationOnTypes, false);
}
}
+ CompilationAndWeavingContext.leavingPhase(tok);
}
private boolean doDeclareParents(DeclareParents declareParents, SourceTypeBinding sourceType) {
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS, sourceType.sourceName);
List newParents = declareParents.findMatchingNewParents(factory.fromEclipse(sourceType),false);
if (!newParents.isEmpty()) {
for (Iterator i = newParents.iterator(); i.hasNext(); ) {
@@ -576,8 +598,10 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
addParent(sourceType, parent);
}
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return true;
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
@@ -608,7 +632,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
if (!decA.matches(rtx)) return false;
if (!rtx.isExposedToWeaver()) return false;
-
+ ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_ANNOTATIONS, sourceType.sourceName);
+
// Get the annotation specified in the declare
TypeBinding tb = factory.makeTypeBinding(decA.getAspect());
@@ -635,12 +660,16 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
// FIXME asc we have a lint for attempting to add an annotation twice to a method,
// we could put it out here *if* we can resolve the problem of errors coming out
// multiple times if we have cause to loop through here
- if (a.equals(b)) return false;
+ if (a.equals(b)) {
+ CompilationAndWeavingContext.leavingPhase(tok);
+ return false;
+ }
}
if (((abits & TagBits.AnnotationTargetMASK)!=0)) {
if ( (abits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType))==0) {
// this means it specifies something other than annotation or normal type - error will have been already reported, just resolution process above
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
if ( (sourceType.isAnnotationType() && (abits & TagBits.AnnotationForAnnotationType)==0) ||
@@ -659,6 +688,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
// }
// }
}
+ CompilationAndWeavingContext.leavingPhase(tok);
return false;
}
}
@@ -675,6 +705,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
System.arraycopy(abefore,0,newset,toAdd.length,abefore.length);
}
sourceType.scope.referenceContext.annotations = newset;
+ CompilationAndWeavingContext.leavingPhase(tok);
return true;
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
index 203089371..4cacecc36 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
@@ -13,6 +13,8 @@
package org.aspectj.ajdt.internal.compiler.problem;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.List;
@@ -22,6 +24,7 @@ import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
import org.aspectj.ajdt.internal.compiler.ast.Proceed;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.InterTypeMethodBinding;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -430,4 +433,64 @@ public class AjProblemReporter extends ProblemReporter {
if (currentMethod == inheritedMethod) return;
super.finalMethodCannotBeOverridden(currentMethod, inheritedMethod);
}
+
+ /**
+ * All problems end up routed through here at some point...
+ */
+ public IProblem createProblem(char[] fileName, int problemId, String[] problemArguments, String[] messageArguments, int severity, int problemStartPosition, int problemEndPosition, int lineNumber) {
+ IProblem problem = super.createProblem(fileName, problemId, problemArguments,
+ messageArguments, severity, problemStartPosition, problemEndPosition,
+ lineNumber);
+ if (factory.getWorld().isInPinpointMode()) {
+ MessageIssued ex = new MessageIssued();
+ ex.fillInStackTrace();
+ StringWriter sw = new StringWriter();
+ ex.printStackTrace(new PrintWriter(sw));
+ StringBuffer sb = new StringBuffer();
+ sb.append(CompilationAndWeavingContext.getCurrentContext());
+ sb.append(sw.toString());
+ problem = new PinpointedProblem(problem,sb.toString());
+ }
+ return problem;
+ }
+
+ private static class MessageIssued extends RuntimeException {
+ public String getMessage() {
+ return "message issued...";
+ }
+ }
+
+ private static class PinpointedProblem implements IProblem {
+
+ private IProblem delegate;
+ private String message;
+
+ public PinpointedProblem(IProblem aProblem, String pinpoint) {
+ this.delegate = aProblem;
+ // if this was a problem that came via the weaver, it will already have
+ // pinpoint info, don't do it twice...
+ if (delegate.getMessage().indexOf("message issued...") == -1) {
+ this.message = delegate.getMessage() + "\n" + pinpoint;
+ } else {
+ this.message = delegate.getMessage();
+ }
+ }
+
+ public String[] getArguments() {return delegate.getArguments();}
+ public int getID() {return delegate.getID();}
+ public String getMessage() { return message; }
+ public char[] getOriginatingFileName() {return delegate.getOriginatingFileName();}
+ public int getSourceEnd() { return delegate.getSourceEnd();}
+ public int getSourceLineNumber() { return delegate.getSourceLineNumber();}
+ public int getSourceStart() { return delegate.getSourceStart();}
+ public boolean isError() { return delegate.isError();}
+ public boolean isWarning() { return delegate.isWarning();}
+ public void setSourceEnd(int sourceEnd) { delegate.setSourceEnd(sourceEnd); }
+ public void setSourceLineNumber(int lineNumber) { delegate.setSourceLineNumber(lineNumber);}
+ public void setSourceStart(int sourceStart) { delegate.setSourceStart(sourceStart);}
+ public void setSeeAlsoProblems(IProblem[] problems) { delegate.setSeeAlsoProblems(problems);}
+ public IProblem[] seeAlso() { return delegate.seeAlso();}
+ public void setSupplementaryMessageInfo(String msg) { delegate.setSupplementaryMessageInfo(msg);}
+ public String getSupplementaryMessageInfo() { return delegate.getSupplementaryMessageInfo();}
+ }
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
index 26cc3fe25..6a0b0e228 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
@@ -485,6 +485,14 @@ public class AjBuildConfig {
return options.xHasMember;
}
+ public void setXdevPinpointMode(boolean enabled) {
+ options.xdevPinpoint = enabled;
+ }
+
+ public boolean isXdevPinpoint() {
+ return options.xdevPinpoint;
+ }
+
public boolean isXreweavable() {
return options.xReweavable;
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index 0a3887882..55ddf133a 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -56,6 +56,9 @@ import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.SourceLocation;
import org.aspectj.bridge.Version;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
+import org.aspectj.bridge.context.ContextFormatter;
+import org.aspectj.bridge.context.ContextToken;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
@@ -74,7 +77,6 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.aspectj.util.FileUtil;
import org.aspectj.weaver.Dump;
-import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.bcel.BcelWeaver;
@@ -101,7 +103,14 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
* the latter will get used.
*/
private static AsmHierarchyBuilder asmHierarchyBuilder = new AsmHierarchyBuilder();
-
+
+ static {
+ CompilationAndWeavingContext.registerFormatter(
+ CompilationAndWeavingContext.BATCH_BUILD, new AjBuildContexFormatter());
+ CompilationAndWeavingContext.registerFormatter(
+ CompilationAndWeavingContext.INCREMENTAL_BUILD, new AjBuildContexFormatter());
+ }
+
private IProgressListener progressListener = null;
private int compiledCount;
@@ -158,6 +167,8 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
boolean ret = true;
batchCompile = batch;
+ int phase = batch ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD;
+ ContextToken ct = CompilationAndWeavingContext.enteringPhase(phase ,buildConfig);
try {
if (batch) {
this.state = new AjState(this);
@@ -269,6 +280,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
AsmManager.getDefault().fireModelUpdated();
}
} finally {
+ CompilationAndWeavingContext.leavingPhase(ct);
if (zos != null) {
closeOutputStream(buildConfig.getOutputJar());
}
@@ -538,6 +550,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
bcelWorld.setXnoInline(buildConfig.isXnoInline());
bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp());
bcelWorld.setXHasMemberSupportEnabled(buildConfig.isXHasMemberEnabled());
+ bcelWorld.setPinpointMode(buildConfig.isXdevPinpoint());
BcelWeaver bcelWeaver = new BcelWeaver(bcelWorld);
state.setWorld(bcelWorld);
state.setWeaver(bcelWeaver);
@@ -1056,5 +1069,26 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
public void setState(AjState buildState) {
state = buildState;
}
+
+ private static class AjBuildContexFormatter implements ContextFormatter {
+
+ public String formatEntry(int phaseId, Object data) {
+ StringBuffer sb = new StringBuffer();
+ if (phaseId == CompilationAndWeavingContext.BATCH_BUILD) {
+ sb.append("batch building ");
+ } else {
+ sb.append("incrementally building ");
+ }
+ AjBuildConfig config = (AjBuildConfig) data;
+ List classpath = config.getClasspath();
+ sb.append("with classpath: ");
+ for (Iterator iter = classpath.iterator(); iter.hasNext();) {
+ sb.append(iter.next().toString());
+ sb.append(File.pathSeparator);
+ }
+ return sb.toString();
+ }
+
+ }
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java
index 8c13e00b1..ce206580d 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java
@@ -43,6 +43,7 @@ public class AjCompilerOptions extends CompilerOptions {
public static final String OPTION_XReweavable = "org.aspectj.ajdt.core.compiler.weaver.XReweavable";
public static final String OPTION_XReweavableCompress = "org.aspectj.ajdt.core.compiler.weaver.XReweavableCompress";
public static final String OPTION_XHasMember = "org.aspectj.ajdt.core.compiler.weaver.XHasMember";
+ public static final String OPTION_XdevPinpoint = "org.aspectj.ajdt.core.compiler.weaver.XdevPinpoint";
// these next four not exposed by IDEs
public static final String OPTION_XDevNoAtAspectJProcessing = "org.aspectj.ajdt.core.compiler.ast.NoAtAspectJProcessing";
@@ -68,6 +69,7 @@ public class AjCompilerOptions extends CompilerOptions {
public boolean xReweavable = false;
public boolean xReweavableCompress = false;
public boolean xHasMember = false;
+ public boolean xdevPinpoint = false;
public boolean showWeavingInformation = false;
// If true - autoboxing behaves differently ...
@@ -122,6 +124,7 @@ public class AjCompilerOptions extends CompilerOptions {
map.put(OPTION_XReweavable,this.xReweavable ? ENABLED : DISABLED);
map.put(OPTION_XReweavableCompress,this.xReweavableCompress ? ENABLED : DISABLED);
map.put(OPTION_XHasMember, this.xHasMember ? ENABLED : DISABLED);
+ map.put(OPTION_XdevPinpoint, this.xdevPinpoint ? ENABLED : DISABLED);
map.put(OPTION_GenerateModel,this.generateModel ? ENABLED : DISABLED);
map.put(OPTION_GenerateJavaDocsInModel,this.generateJavaDocsInModel ? ENABLED : DISABLED);
@@ -196,7 +199,15 @@ public class AjCompilerOptions extends CompilerOptions {
this.xHasMember = false;
}
}
-
+
+ if ((optionValue = optionsMap.get(OPTION_XdevPinpoint)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.xdevPinpoint = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.xdevPinpoint = false;
+ }
+ }
+
if ((optionValue = optionsMap.get(OPTION_GenerateModel)) != null) {
if (ENABLED.equals(optionValue)) {
this.generateModel = true;
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java
index 8198012b0..c8b7b2e2f 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java
@@ -159,6 +159,7 @@ public class AspectJBuilder extends JavaBuilder implements ICompilerAdapterFacto
myBcelWorld.setXnoInline(options.xNoInline);
myBcelWorld.setXlazyTjp(options.xLazyThisJoinPoint);
myBcelWorld.setXHasMemberSupportEnabled(options.xHasMember);
+ myBcelWorld.setPinpointMode(options.xdevPinpoint);
setLintProperties(myBcelWorld,options);
myWeaver = new BcelWeaver(myBcelWorld);
myWeaver.setReweavableMode(options.xReweavable,options.xReweavableCompress);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
index 9bda53768..e250c6b29 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
@@ -33,6 +33,7 @@ import org.aspectj.bridge.MessageHandler;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.ReflectionFactory;
import org.aspectj.bridge.Version;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.util.FileUtil;
import org.aspectj.util.LangUtil;
@@ -143,6 +144,7 @@ public class Main {
String m = thrown.getMessage();
return THROWN_PREFIX
+ (null != m ? m + "\n": "")
+ + CompilationAndWeavingContext.getCurrentContext()
+ LangUtil.renderException(thrown, true);
}