Package org.checkerframework.javacutil
Class BasicAnnotationProvider
- java.lang.Object
-
- org.checkerframework.javacutil.BasicAnnotationProvider
-
- All Implemented Interfaces:
AnnotationProvider
public class BasicAnnotationProvider extends java.lang.Object implements AnnotationProvider
An AnnotationProvider that is independent of any type hierarchy.
-
-
Constructor Summary
Constructors Constructor Description BasicAnnotationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable javax.lang.model.element.AnnotationMirror
getAnnotationMirror(com.sun.source.tree.Tree tree, java.lang.Class<? extends java.lang.annotation.Annotation> target)
Return the annotation ontree
that is in the hierarchy that contains the qualifiertarget
.@Nullable javax.lang.model.element.AnnotationMirror
getDeclAnnotation(javax.lang.model.element.Element elt, java.lang.Class<? extends java.lang.annotation.Annotation> anno)
Returns the AnnotationMirror, of the given class, used to annotate the element.boolean
isSideEffectFree(javax.lang.model.element.ExecutableElement methodElement)
Returns true if the given method is side-effect-free according to this AnnotationProvider — that is, if a call to the given method does not undo flow-sensitive type refinement.
-
-
-
Method Detail
-
getDeclAnnotation
public @Nullable javax.lang.model.element.AnnotationMirror getDeclAnnotation(javax.lang.model.element.Element elt, java.lang.Class<? extends java.lang.annotation.Annotation> anno)
Returns the AnnotationMirror, of the given class, used to annotate the element. Returns null if no such annotation exists.- Specified by:
getDeclAnnotation
in interfaceAnnotationProvider
- Parameters:
elt
- the elementanno
- annotation class- Returns:
- an annotation mirror of class
anno
onelt
, or an equivalent one, or null if none exists onanno
-
getAnnotationMirror
public @Nullable javax.lang.model.element.AnnotationMirror getAnnotationMirror(com.sun.source.tree.Tree tree, java.lang.Class<? extends java.lang.annotation.Annotation> target)
Return the annotation ontree
that is in the hierarchy that contains the qualifiertarget
. Returns null if none exists.This implementation always returns null, because it has no access to any type hierarchy.
- Specified by:
getAnnotationMirror
in interfaceAnnotationProvider
- Parameters:
tree
- the tree of which the annotation is returnedtarget
- the class of the annotation- Returns:
- the annotation on
tree
that has the classtarget
, or null
-
isSideEffectFree
public boolean isSideEffectFree(javax.lang.model.element.ExecutableElement methodElement)
Returns true if the given method is side-effect-free according to this AnnotationProvider — that is, if a call to the given method does not undo flow-sensitive type refinement.Note that this method takes account of this AnnotationProvider's semantics, whereas
org.checkerframework.dataflow.util.PurityUtils#isSideEffectFree
does not.This implementation returns true if the
@SideEffectFree
annotation is present on the given method.- Specified by:
isSideEffectFree
in interfaceAnnotationProvider
- Parameters:
methodElement
- a method- Returns:
- true if a call to the method does not undo flow-sensitive type refinement
-
-