javacutil.src.org.checkerframework.javacutil.BasicAnnotationProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker Show documentation
Show all versions of checker Show documentation
The Checker Framework enhances Java’s type system to
make it more powerful and useful. This lets software developers
detect and prevent errors in their Java programs.
The Checker Framework includes compiler plug-ins ("checkers")
that find bugs or verify their absence. It also permits you to
write your own compiler plug-ins.
package org.checkerframework.javacutil;
import java.lang.annotation.Annotation;
import java.util.List;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import com.sun.source.tree.Tree;
public class BasicAnnotationProvider implements AnnotationProvider {
@Override
public AnnotationMirror getDeclAnnotation(Element elt,
Class anno) {
List annotationMirrors = elt
.getAnnotationMirrors();
// Then look at the real annotations.
for (AnnotationMirror am : annotationMirrors) {
if (AnnotationUtils.areSameByClass(am, anno)) {
return am;
}
}
return null;
}
@Override
public AnnotationMirror getAnnotationMirror(Tree tree,
Class target) {
return null;
}
}