comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java @ 11466:4830676526e3

Truffle-DSL: added infrastructure to assert for DSL error messages.
author Christian Humer <christian.humer@gmail.com>
date Thu, 29 Aug 2013 17:39:55 +0200
parents fc509b6fbfdf
children 43eab069ca9b
comparison
equal deleted inserted replaced
11465:3d618420a4b6 11466:4830676526e3
753 return findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), annotationClass); 753 return findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), annotationClass);
754 } 754 }
755 755
756 public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List<? extends AnnotationMirror> mirrors, Class<?> annotationClass) { 756 public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List<? extends AnnotationMirror> mirrors, Class<?> annotationClass) {
757 TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getCanonicalName()); 757 TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getCanonicalName());
758 return findAnnotationMirror(mirrors, expectedAnnotationType);
759 }
760
761 public static AnnotationMirror findAnnotationMirror(List<? extends AnnotationMirror> mirrors, TypeElement expectedAnnotationType) {
758 for (AnnotationMirror mirror : mirrors) { 762 for (AnnotationMirror mirror : mirrors) {
759 DeclaredType annotationType = mirror.getAnnotationType(); 763 DeclaredType annotationType = mirror.getAnnotationType();
760 TypeElement actualAnnotationType = (TypeElement) annotationType.asElement(); 764 TypeElement actualAnnotationType = (TypeElement) annotationType.asElement();
761 if (actualAnnotationType.equals(expectedAnnotationType)) { 765 if (actualAnnotationType.equals(expectedAnnotationType)) {
762 return mirror; 766 return mirror;