Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java @ 7530:5e3d1a68664e
applied mx eclipseformat to all Java files
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 23 Jan 2013 16:34:57 +0100 |
parents | 40133ce026c6 |
children | 0905d796944a |
comparison
equal
deleted
inserted
replaced
7529:4a11124a3563 | 7530:5e3d1a68664e |
---|---|
34 import com.oracle.truffle.codegen.processor.typesystem.*; | 34 import com.oracle.truffle.codegen.processor.typesystem.*; |
35 | 35 |
36 /** | 36 /** |
37 * THIS IS NOT PUBLIC API. | 37 * THIS IS NOT PUBLIC API. |
38 */ | 38 */ |
39 //@SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation", "com.oracle.truffle.codegen.TypeLattice"}) | 39 // @SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation", |
40 // "com.oracle.truffle.codegen.TypeLattice"}) | |
40 @SupportedSourceVersion(SourceVersion.RELEASE_7) | 41 @SupportedSourceVersion(SourceVersion.RELEASE_7) |
41 public class TruffleProcessor extends AbstractProcessor implements ProcessCallback { | 42 public class TruffleProcessor extends AbstractProcessor implements ProcessCallback { |
42 | 43 |
43 private ProcessorContext context; | 44 private ProcessorContext context; |
44 private List<AnnotationProcessor< ? >> generators; | 45 private List<AnnotationProcessor<?>> generators; |
45 | 46 |
46 private RoundEnvironment round; | 47 private RoundEnvironment round; |
47 | 48 |
48 @Override | 49 @Override |
49 public boolean process(Set< ? extends TypeElement> annotations, RoundEnvironment roundEnv) { | 50 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
50 if (!roundEnv.processingOver()) { | 51 if (!roundEnv.processingOver()) { |
51 processImpl(roundEnv); | 52 processImpl(roundEnv); |
52 } | 53 } |
53 return false; | 54 return false; |
54 } | 55 } |
55 | 56 |
56 private void processImpl(RoundEnvironment env) { | 57 private void processImpl(RoundEnvironment env) { |
57 this.round = env; | 58 this.round = env; |
58 // TODO run verifications that other annotations are not processed out of scope of the operation or typelattice. | 59 // TODO run verifications that other annotations are not processed out of scope of the |
60 // operation or typelattice. | |
59 try { | 61 try { |
60 for (AnnotationProcessor generator : getGenerators()) { | 62 for (AnnotationProcessor generator : getGenerators()) { |
61 AbstractParser<?> parser = generator.getParser(); | 63 AbstractParser<?> parser = generator.getParser(); |
62 if (parser.getAnnotationType() != null) { | 64 if (parser.getAnnotationType() != null) { |
63 for (Element e : env.getElementsAnnotatedWith(parser.getAnnotationType())) { | 65 for (Element e : env.getElementsAnnotatedWith(parser.getAnnotationType())) { |
114 public Set<String> getSupportedAnnotationTypes() { | 116 public Set<String> getSupportedAnnotationTypes() { |
115 Set<String> annotations = new HashSet<>(); | 117 Set<String> annotations = new HashSet<>(); |
116 List<Class<? extends Annotation>> annotationsTypes = new ArrayList<>(); | 118 List<Class<? extends Annotation>> annotationsTypes = new ArrayList<>(); |
117 annotationsTypes.addAll(NodeParser.ANNOTATIONS); | 119 annotationsTypes.addAll(NodeParser.ANNOTATIONS); |
118 annotationsTypes.addAll(TypeSystemParser.ANNOTATIONS); | 120 annotationsTypes.addAll(TypeSystemParser.ANNOTATIONS); |
119 for (Class< ? extends Annotation > type : annotationsTypes) { | 121 for (Class<? extends Annotation> type : annotationsTypes) { |
120 annotations.add(type.getCanonicalName()); | 122 annotations.add(type.getCanonicalName()); |
121 } | 123 } |
122 return annotations; | 124 return annotations; |
123 } | 125 } |
124 | 126 |
125 private List<AnnotationProcessor< ? >> getGenerators() { | 127 private List<AnnotationProcessor<?>> getGenerators() { |
126 if (generators == null && processingEnv != null) { | 128 if (generators == null && processingEnv != null) { |
127 generators = new ArrayList<>(); | 129 generators = new ArrayList<>(); |
128 generators.add(new AnnotationProcessor<>(getContext(), new TypeSystemParser(getContext()), new TypeSystemCodeGenerator(getContext()))); | 130 generators.add(new AnnotationProcessor<>(getContext(), new TypeSystemParser(getContext()), new TypeSystemCodeGenerator(getContext()))); |
129 generators.add(new AnnotationProcessor<>(getContext(), new NodeParser(getContext()), new NodeCodeGenerator(getContext()))); | 131 generators.add(new AnnotationProcessor<>(getContext(), new NodeParser(getContext()), new NodeCodeGenerator(getContext()))); |
130 } | 132 } |