Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/ast/CodeElement.java @ 16757:0cd0bdedd4ad
Truffle-DSL: removed old writable AST API.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:53:05 +0200 |
parents | 55fd5be68a52 |
children |
comparison
equal
deleted
inserted
replaced
16756:5148aab962af | 16757:0cd0bdedd4ad |
---|---|
26 import java.lang.annotation.*; | 26 import java.lang.annotation.*; |
27 import java.util.*; | 27 import java.util.*; |
28 | 28 |
29 import javax.lang.model.element.*; | 29 import javax.lang.model.element.*; |
30 | 30 |
31 import com.oracle.truffle.dsl.processor.api.element.*; | |
32 import com.oracle.truffle.dsl.processor.codewriter.*; | 31 import com.oracle.truffle.dsl.processor.codewriter.*; |
33 | 32 |
34 public abstract class CodeElement<E extends Element> implements WritableElement, GeneratedElement { | 33 public abstract class CodeElement<E extends Element> implements Element, GeneratedElement { |
35 | 34 |
36 private final Set<Modifier> modifiers; | 35 private final Set<Modifier> modifiers; |
37 private List<AnnotationMirror> annotations; | 36 private List<AnnotationMirror> annotations; |
38 private List<E> enclosedElements; | 37 private List<E> enclosedElements; |
39 | 38 |
44 | 43 |
45 public CodeElement() { | 44 public CodeElement() { |
46 this.modifiers = new LinkedHashSet<>(); | 45 this.modifiers = new LinkedHashSet<>(); |
47 } | 46 } |
48 | 47 |
48 public CodeElement(Set<Modifier> modifiers) { | |
49 this.modifiers = new LinkedHashSet<>(modifiers); | |
50 } | |
51 | |
49 @Override | 52 @Override |
50 public void setGeneratorAnnotationMirror(AnnotationMirror mirror) { | 53 public void setGeneratorAnnotationMirror(AnnotationMirror mirror) { |
51 this.generatorAnnotationMirror = mirror; | 54 this.generatorAnnotationMirror = mirror; |
52 } | 55 } |
53 | 56 |
62 } | 65 } |
63 | 66 |
64 @Override | 67 @Override |
65 public Element getGeneratorElement() { | 68 public Element getGeneratorElement() { |
66 return generatorElement; | 69 return generatorElement; |
67 } | |
68 | |
69 public CodeElement(Set<Modifier> modifiers) { | |
70 this.modifiers = new LinkedHashSet<>(modifiers); | |
71 } | 70 } |
72 | 71 |
73 public E add(E element) { | 72 public E add(E element) { |
74 if (element == null) { | 73 if (element == null) { |
75 throw new NullPointerException(); | 74 throw new NullPointerException(); |
135 */ | 134 */ |
136 public <A extends Annotation> A getAnnotation(Class<A> annotationType) { | 135 public <A extends Annotation> A getAnnotation(Class<A> annotationType) { |
137 throw new UnsupportedOperationException(); | 136 throw new UnsupportedOperationException(); |
138 } | 137 } |
139 | 138 |
140 @Override | |
141 public void addAnnotationMirror(AnnotationMirror annotationMirror) { | 139 public void addAnnotationMirror(AnnotationMirror annotationMirror) { |
142 getAnnotationMirrors().add(annotationMirror); | 140 getAnnotationMirrors().add(annotationMirror); |
143 } | 141 } |
144 | 142 |
145 public void removeAnnotationMirror(AnnotationMirror annotationMirror) { | 143 public void removeAnnotationMirror(AnnotationMirror annotationMirror) { |