diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java @ 9210:160f088e40db

Made handling of compile errors more robust in the truffle annotation parser.
author Christian Humer <christian.humer@gmail.com>
date Mon, 08 Apr 2013 16:50:51 +0200
parents 0905d796944a
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java	Mon Apr 08 16:50:17 2013 +0200
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java	Mon Apr 08 16:50:51 2013 +0200
@@ -27,6 +27,7 @@
 
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
+import javax.tools.Diagnostic.Kind;
 
 import com.oracle.truffle.codegen.processor.template.*;
 
@@ -49,6 +50,7 @@
 
     public final M parse(RoundEnvironment env, Element element) {
         this.roundEnv = env;
+        M model = null;
         try {
             AnnotationMirror mirror = null;
             if (getAnnotationType() != null) {
@@ -58,13 +60,16 @@
             if (!context.getTruffleTypes().verify(context, element, mirror)) {
                 return null;
             }
-            M model = parse(element, mirror);
+            model = parse(element, mirror);
             if (model == null) {
                 return null;
             }
 
             model.emitMessages((TypeElement) element, log);
             return filterErrorElements(model);
+        } catch (CompileErrorException e) {
+            log.message(Kind.WARNING, element, null, null, "The truffle processor could not parse class due to error: %s", e.getMessage());
+            return null;
         } finally {
             this.roundEnv = null;
         }