Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/LanguageRegistrationProcessor.java @ 21557:31fc2fce38f3
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 13:32:18 +0200 |
parents | b1530a6cce8c f5b49d881909 |
children | 2f9e4d984d16 |
comparison
equal
deleted
inserted
replaced
21556:48c1ebd24120 | 21557:31fc2fce38f3 |
---|---|
32 import javax.tools.Diagnostic.Kind; | 32 import javax.tools.Diagnostic.Kind; |
33 import javax.tools.*; | 33 import javax.tools.*; |
34 | 34 |
35 import com.oracle.truffle.api.*; | 35 import com.oracle.truffle.api.*; |
36 import com.oracle.truffle.api.TruffleLanguage.Registration; | 36 import com.oracle.truffle.api.TruffleLanguage.Registration; |
37 import com.oracle.truffle.api.dsl.*; | |
38 | 37 |
39 @SupportedAnnotationTypes("com.oracle.truffle.api.*") | 38 @SupportedAnnotationTypes("com.oracle.truffle.api.*") |
40 public final class LanguageRegistrationProcessor extends AbstractProcessor { | 39 public final class LanguageRegistrationProcessor extends AbstractProcessor { |
41 @Override | 40 @Override |
42 public SourceVersion getSupportedSourceVersion() { | 41 public SourceVersion getSupportedSourceVersion() { |
110 | 109 |
111 return true; | 110 return true; |
112 } | 111 } |
113 | 112 |
114 void assertNoErrorExpected(Element e) { | 113 void assertNoErrorExpected(Element e) { |
115 TypeElement eee = processingEnv.getElementUtils().getTypeElement(ExpectError.class.getName()); | 114 ExpectError.assertNoErrorExpected(processingEnv, e); |
116 for (AnnotationMirror am : e.getAnnotationMirrors()) { | |
117 if (am.getAnnotationType().asElement().equals(eee)) { | |
118 processingEnv.getMessager().printMessage(Kind.ERROR, "Expected an error, but none found!", e); | |
119 } | |
120 } | |
121 } | 115 } |
122 | 116 |
123 void emitError(String msg, Element e) { | 117 void emitError(String msg, Element e) { |
124 TypeElement eee = processingEnv.getElementUtils().getTypeElement(ExpectError.class.getName()); | 118 if (ExpectError.isExpectedError(processingEnv, e, msg)) { |
125 for (AnnotationMirror am : e.getAnnotationMirrors()) { | 119 return; |
126 if (am.getAnnotationType().asElement().equals(eee)) { | |
127 Map<? extends ExecutableElement, ? extends AnnotationValue> vals = am.getElementValues(); | |
128 if (vals.size() == 1) { | |
129 AnnotationValue av = vals.values().iterator().next(); | |
130 if (av.getValue() instanceof List) { | |
131 List<?> arr = (List<?>) av.getValue(); | |
132 for (Object o : arr) { | |
133 if (o instanceof AnnotationValue) { | |
134 AnnotationValue ov = (AnnotationValue) o; | |
135 if (msg.equals(ov.getValue())) { | |
136 return; | |
137 } | |
138 } | |
139 } | |
140 } | |
141 } | |
142 } | |
143 } | 120 } |
144 processingEnv.getMessager().printMessage(Kind.ERROR, msg, e); | 121 processingEnv.getMessager().printMessage(Kind.ERROR, msg, e); |
145 } | 122 } |
123 | |
146 } | 124 } |