summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-29 15:40:48 +0000
committeracolyer <acolyer>2005-09-29 15:40:48 +0000
commit5fdb986e1843518b4766c21b1be3b85af780731c (patch)
tree7d8b125338ad28826654ab7e800c56c64b13c9ea
parent2650003fea1d611357b741b8d9a2b5c239858541 (diff)
downloadaspectj-5fdb986e1843518b4766c21b1be3b85af780731c.tar.gz
aspectj-5fdb986e1843518b4766c21b1be3b85af780731c.zip
give compilation context on compiler crashes during test case runs
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java
index 89c40e1bf..9ccf23da0 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/Ajc.java
@@ -22,10 +22,13 @@ import java.util.StringTokenizer;
import junit.framework.AssertionFailedError;
+import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.ICommand;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageHandler;
+import org.aspectj.bridge.IMessage.Kind;
+import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.util.FileUtil;
/**
@@ -185,6 +188,7 @@ public class Ajc {
}
args = adjustToSandbox(args,!isIncremental);
MessageHandler holder = new MessageHandler();
+ holder.setInterceptor(new AbortInterceptor());
main.setHolder(holder);
if (incrementalStage==10 && hasSpecifiedIncremental(args)) {
// important to sleep after preparing the sandbox on first incremental stage (see notes in pr90806)
@@ -441,3 +445,27 @@ class AjcCommandController extends Main.CommandController {
command.repeatCommand(handler);
}
}
+
+class AbortInterceptor implements IMessageHandler {
+
+ public boolean handleMessage(IMessage message) throws AbortException {
+ if (message.getKind() == IMessage.ABORT) {
+ System.err.println("***** Abort Message Received ******");
+ System.err.println(CompilationAndWeavingContext.getCurrentContext());
+ System.err.println(message.getMessage());
+ if (message.getThrown() != null) {
+ System.err.println("caused by " + message.getThrown().toString());
+ }
+
+ } // allow message to accumulate...
+ return false;
+ }
+
+ public boolean isIgnoring(Kind kind) {
+ if (kind != IMessage.ABORT) return true;
+ return false;
+ }
+
+ public void dontIgnore(Kind kind) {
+ }
+}