# HG changeset patch # User Christian Humer # Date 1365432651 -7200 # Node ID 160f088e40db9430a4105a8d80ea6639dc1e38cf # Parent 119a20bb3b1dc974c7420a513d7d9cb316e1d21c Made handling of compile errors more robust in the truffle annotation parser. diff -r 119a20bb3b1d -r 160f088e40db graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java --- 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; } diff -r 119a20bb3b1d -r 160f088e40db graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java Mon Apr 08 16:50:17 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java Mon Apr 08 16:50:51 2013 +0200 @@ -210,6 +210,8 @@ return b.toString(); case TYPEVAR: return "Any"; + case ERROR: + throw new CompileErrorException("Type error " + mirror); default: throw new RuntimeException("Unknown type specified " + mirror.getKind() + " mirror: " + mirror); } @@ -247,6 +249,8 @@ return getWildcardName((WildcardType) mirror); case TYPEVAR: return "?"; + case ERROR: + throw new CompileErrorException("Type error " + mirror); default: throw new RuntimeException("Unknown type specified " + mirror.getKind() + " mirror: " + mirror); } @@ -313,6 +317,8 @@ return "void"; case TYPEVAR: return getSimpleName(mirror); + case ERROR: + throw new CompileErrorException("Type error " + mirror); default: throw new RuntimeException("Unknown type specified " + mirror + " mirror: " + mirror); }