Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/MessageContainer.java @ 16832:13cf9b6b325c
Truffle-DSL: implemented import guards feature.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 14 Aug 2014 16:49:18 +0200 |
parents | 23415229349b |
children | 62c43fcf5be2 |
comparison
equal
deleted
inserted
replaced
16830:c3c07046a74b | 16832:13cf9b6b325c |
---|---|
33 public abstract class MessageContainer implements Iterable<MessageContainer> { | 33 public abstract class MessageContainer implements Iterable<MessageContainer> { |
34 | 34 |
35 private final List<Message> messages = new ArrayList<>(); | 35 private final List<Message> messages = new ArrayList<>(); |
36 | 36 |
37 public final void addWarning(String text, Object... params) { | 37 public final void addWarning(String text, Object... params) { |
38 getMessages().add(new Message(null, this, String.format(text, params), Kind.WARNING)); | 38 getMessages().add(new Message(null, null, this, String.format(text, params), Kind.WARNING)); |
39 } | 39 } |
40 | 40 |
41 public final void addWarning(AnnotationValue value, String text, Object... params) { | 41 public final void addWarning(AnnotationValue value, String text, Object... params) { |
42 getMessages().add(new Message(value, this, String.format(text, params), Kind.WARNING)); | 42 getMessages().add(new Message(null, value, this, String.format(text, params), Kind.WARNING)); |
43 } | 43 } |
44 | 44 |
45 public final void addError(String text, Object... params) { | 45 public final void addError(String text, Object... params) { |
46 addError(null, text, params); | 46 addError(null, text, params); |
47 } | 47 } |
48 | 48 |
49 public final void addError(AnnotationValue value, String text, Object... params) { | 49 public final void addError(AnnotationValue value, String text, Object... params) { |
50 getMessages().add(new Message(value, this, String.format(text, params), Kind.ERROR)); | 50 getMessages().add(new Message(null, value, this, String.format(text, params), Kind.ERROR)); |
51 } | |
52 | |
53 public final void addError(AnnotationMirror mirror, AnnotationValue value, String text, Object... params) { | |
54 getMessages().add(new Message(mirror, value, this, String.format(text, params), Kind.ERROR)); | |
51 } | 55 } |
52 | 56 |
53 protected List<MessageContainer> findChildContainers() { | 57 protected List<MessageContainer> findChildContainers() { |
54 return Collections.emptyList(); | 58 return Collections.emptyList(); |
55 } | 59 } |
134 Element messageElement = getMessageElement(); | 138 Element messageElement = getMessageElement(); |
135 AnnotationMirror messageAnnotation = getMessageAnnotation(); | 139 AnnotationMirror messageAnnotation = getMessageAnnotation(); |
136 AnnotationValue messageValue = getMessageAnnotationValue(); | 140 AnnotationValue messageValue = getMessageAnnotationValue(); |
137 if (message.getAnnotationValue() != null) { | 141 if (message.getAnnotationValue() != null) { |
138 messageValue = message.getAnnotationValue(); | 142 messageValue = message.getAnnotationValue(); |
143 } | |
144 if (message.getAnnotationMirror() != null) { | |
145 messageAnnotation = message.getAnnotationMirror(); | |
139 } | 146 } |
140 | 147 |
141 String text = message.getText(); | 148 String text = message.getText(); |
142 | 149 |
143 TypeElement expectError = context.getTruffleTypes().getExpectError(); | 150 TypeElement expectError = context.getTruffleTypes().getExpectError(); |
222 } | 229 } |
223 | 230 |
224 public static final class Message { | 231 public static final class Message { |
225 | 232 |
226 private final MessageContainer originalContainer; | 233 private final MessageContainer originalContainer; |
234 private final AnnotationMirror annotationMirror; | |
227 private final AnnotationValue annotationValue; | 235 private final AnnotationValue annotationValue; |
228 private final String text; | 236 private final String text; |
229 private final Kind kind; | 237 private final Kind kind; |
230 | 238 |
231 public Message(AnnotationValue annotationValue, MessageContainer originalContainer, String text, Kind kind) { | 239 public Message(AnnotationMirror annotationMirror, AnnotationValue annotationValue, MessageContainer originalContainer, String text, Kind kind) { |
240 this.annotationMirror = annotationMirror; | |
232 this.annotationValue = annotationValue; | 241 this.annotationValue = annotationValue; |
233 this.originalContainer = originalContainer; | 242 this.originalContainer = originalContainer; |
234 this.text = text; | 243 this.text = text; |
235 this.kind = kind; | 244 this.kind = kind; |
236 } | 245 } |
237 | 246 |
247 public AnnotationMirror getAnnotationMirror() { | |
248 return annotationMirror; | |
249 } | |
250 | |
238 public AnnotationValue getAnnotationValue() { | 251 public AnnotationValue getAnnotationValue() { |
239 return annotationValue; | 252 return annotationValue; |
240 } | 253 } |
241 | 254 |
242 public MessageContainer getOriginalContainer() { | 255 public MessageContainer getOriginalContainer() { |