aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-27 15:00:59 +0000
committeracolyer <acolyer>2005-09-27 15:00:59 +0000
commit21804a0c3d3a26b124eca65799b5f6462f6c1d02 (patch)
tree8733e2cb9b5275292b87105b6f283e932006b137
parente76b37012601cf67a069b4a78f60f183efad563d (diff)
downloadaspectj-21804a0c3d3a26b124eca65799b5f6462f6c1d02.tar.gz
aspectj-21804a0c3d3a26b124eca65799b5f6462f6c1d02.zip
improve abort handling for AJDT
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java18
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjCompilerAdapter.java1
2 files changed, 12 insertions, 7 deletions
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
index 7be16e8dd..3de011737 100644
--- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -23,6 +23,7 @@ import org.aspectj.ajde.*;
import org.aspectj.ajdt.ajc.*;
import org.aspectj.ajdt.internal.core.builder.*;
import org.aspectj.bridge.*;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.util.LangUtil;
//import org.eclipse.core.runtime.OperationCanceledException;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -92,6 +93,7 @@ public class CompilerAdapter {
}
init();
try {
+ CompilationAndWeavingContext.reset();
AjBuildConfig buildConfig = genBuildConfig(configFile);
if (buildConfig == null) {
return false;
@@ -127,14 +129,11 @@ public class CompilerAdapter {
// return false;
} catch (AbortException e) {
final IMessage message = e.getIMessage();
- if (null == message) {
- signalThrown(e);
- } else if (null != message.getMessage()) {
- Ajde.getDefault().getErrorHandler().handleWarning(message.getMessage());
- } else if (null != message.getThrown()) {
- signalThrown(message.getThrown());
+ if (message == null) {
+ signalThrown(e);
} else {
- signalThrown(e);
+ String messageText = message.getMessage() + "\n" + CompilationAndWeavingContext.getCurrentContext();
+ Ajde.getDefault().getErrorHandler().handleError(messageText, message.getThrown());
}
return false;
} catch (Throwable t) {
@@ -621,6 +620,7 @@ public class CompilerAdapter {
public boolean handleMessage(IMessage message) throws AbortException {
IMessage.Kind kind = message.getKind();
+ if (kind == IMessage.ABORT) return handleAbort(message);
if (isIgnoring(kind)
|| (!showInfoMessages && IMessage.INFO.equals(kind))) {
return true;
@@ -629,6 +629,10 @@ public class CompilerAdapter {
taskListManager.addSourcelineTask(message);
return super.handleMessage(message); // also store...
}
+
+ private boolean handleAbort(IMessage abortMessage) {
+ throw new AbortException(abortMessage);
+ }
}
public void setState(AjState buildState) {
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 ddc231bec..c055ba263 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
@@ -191,6 +191,7 @@ public class AjCompilerAdapter implements ICompilerAdapter {
}
public void afterProcessing(CompilationUnitDeclaration unit, int unitIndex) {
+ CompilationAndWeavingContext.leavingPhase(processingToken);
eWorld.finishedCompilationUnit(unit);
InterimCompilationResult intRes = new InterimCompilationResult(unit.compilationResult,outputFileNameProvider);
if (unit.compilationResult.hasErrors()) reportedErrors = true;