Mercurial > hg > truffle
changeset 19284:b339d723a06b
Truffle-DSL: refactor ElementUtils#findAnnotationMirror
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 29 Jan 2015 19:07:58 +0100 |
parents | 08aa0372dad4 |
children | 259a416388d7 |
files | graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeVerifier.java graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java |
diffstat | 2 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeVerifier.java Fri Jan 23 02:55:23 2015 +0100 +++ b/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeVerifier.java Thu Jan 29 19:07:58 2015 +0100 @@ -117,7 +117,7 @@ List<? extends AnnotationMirror> annotations = field.getAnnotationMirrors(); - boolean isNonOptionalInput = findAnnotationMirror(annotations, Input) != null; + boolean isNonOptionalInput = findAnnotationMirror(annotations, Input.asType()) != null; boolean isOptionalInput = findAnnotationMirror(annotations, OptionalInput) != null; boolean isSuccessor = findAnnotationMirror(annotations, Successor) != null;
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Fri Jan 23 02:55:23 2015 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java Thu Jan 29 19:07:58 2015 +0100 @@ -855,14 +855,16 @@ public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List<? extends AnnotationMirror> mirrors, Class<?> annotationClass) { TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getCanonicalName()); - return findAnnotationMirror(mirrors, expectedAnnotationType); + return findAnnotationMirror(mirrors, expectedAnnotationType.asType()); } public static AnnotationMirror findAnnotationMirror(List<? extends AnnotationMirror> mirrors, TypeElement expectedAnnotationType) { + return findAnnotationMirror(mirrors, expectedAnnotationType.asType()); + } + + public static AnnotationMirror findAnnotationMirror(List<? extends AnnotationMirror> mirrors, TypeMirror expectedAnnotationType) { for (AnnotationMirror mirror : mirrors) { - DeclaredType annotationType = mirror.getAnnotationType(); - TypeElement actualAnnotationType = (TypeElement) annotationType.asElement(); - if (actualAnnotationType.equals(expectedAnnotationType)) { + if (typeEquals(mirror.getAnnotationType(), expectedAnnotationType)) { return mirror; } }