Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/TruffleTypes.java @ 21494:f5b49d881909
Truffle-DSL: move internal @ExpectError annotation from public API to the test package only; share expect error handling between new processors.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 26 May 2015 20:04:08 +0200 |
parents | b31b2f289e7d |
children |
comparison
equal
deleted
inserted
replaced
21493:99e3f4c5c853 | 21494:f5b49d881909 |
---|---|
41 | 41 |
42 /** | 42 /** |
43 * THIS IS NOT PUBLIC API. | 43 * THIS IS NOT PUBLIC API. |
44 */ | 44 */ |
45 public final class TruffleTypes { | 45 public final class TruffleTypes { |
46 | |
47 public static final String EXPECT_ERROR_CLASS_NAME = "com.oracle.truffle.api.dsl.test.ExpectError"; | |
46 | 48 |
47 private final DeclaredType node; | 49 private final DeclaredType node; |
48 private final ArrayType nodeArray; | 50 private final ArrayType nodeArray; |
49 private final TypeMirror unexpectedValueException; | 51 private final TypeMirror unexpectedValueException; |
50 private final TypeMirror frame; | 52 private final TypeMirror frame; |
92 dslNode = getRequired(context, DSLNode.class); | 94 dslNode = getRequired(context, DSLNode.class); |
93 dslShare = getRequired(context, DSLShare.class); | 95 dslShare = getRequired(context, DSLShare.class); |
94 nodeFactory = getRequired(context, NodeFactory.class); | 96 nodeFactory = getRequired(context, NodeFactory.class); |
95 nodeFactoryBase = getRequired(context, NodeFactoryBase.class); | 97 nodeFactoryBase = getRequired(context, NodeFactoryBase.class); |
96 dslMetadata = getRequired(context, DSLMetadata.class); | 98 dslMetadata = getRequired(context, DSLMetadata.class); |
97 expectError = (TypeElement) getRequired(context, ExpectError.class).asElement(); | 99 expectError = getOptional(context, EXPECT_ERROR_CLASS_NAME); |
98 generateNodeFactory = getRequired(context, GenerateNodeFactory.class); | 100 generateNodeFactory = getRequired(context, GenerateNodeFactory.class); |
99 } | 101 } |
100 | 102 |
101 public DeclaredType getGenerateNodeFactory() { | 103 public DeclaredType getGenerateNodeFactory() { |
102 return generateNodeFactory; | 104 return generateNodeFactory; |
156 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName())); | 158 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName())); |
157 } | 159 } |
158 return (DeclaredType) type; | 160 return (DeclaredType) type; |
159 } | 161 } |
160 | 162 |
163 private static TypeElement getOptional(ProcessorContext context, String name) { | |
164 return context.getEnvironment().getElementUtils().getTypeElement(name); | |
165 } | |
166 | |
161 public TypeMirror getInvalidAssumption() { | 167 public TypeMirror getInvalidAssumption() { |
162 return invalidAssumption; | 168 return invalidAssumption; |
163 } | 169 } |
164 | 170 |
165 public TypeMirror getAssumption() { | 171 public TypeMirror getAssumption() { |