Package org.checkerframework.javacutil
Interface AnnotationProvider
-
- All Known Implementing Classes:
AccumulationAnnotatedTypeFactory
,AliasingAnnotatedTypeFactory
,AnnotatedTypeFactory
,BaseAnnotatedTypeFactory
,BaseAnnotatedTypeFactoryForIndexChecker
,BasicAnnotationProvider
,CalledMethodsAnnotatedTypeFactory
,ClassValAnnotatedTypeFactory
,CompilerMessagesAnnotatedTypeFactory
,FenumAnnotatedTypeFactory
,FormatterAnnotatedTypeFactory
,GenericAnnotatedTypeFactory
,GuiEffectTypeFactory
,I18nAnnotatedTypeFactory
,I18nFormatterAnnotatedTypeFactory
,InitializationAnnotatedTypeFactory
,InitializationFieldAccessAnnotatedTypeFactory
,InitializationParentAnnotatedTypeFactory
,InitializedFieldsAnnotatedTypeFactory
,InterningAnnotatedTypeFactory
,KeyForAnnotatedTypeFactory
,LessThanAnnotatedTypeFactory
,LocalizableKeyAnnotatedTypeFactory
,LockAnnotatedTypeFactory
,LowerBoundAnnotatedTypeFactory
,MethodValAnnotatedTypeFactory
,MustCallAnnotatedTypeFactory
,NullnessNoInitAnnotatedTypeFactory
,PropertyKeyAnnotatedTypeFactory
,PurityAnnotatedTypeFactory
,RegexAnnotatedTypeFactory
,ResourceLeakAnnotatedTypeFactory
,ReturnsReceiverAnnotatedTypeFactory
,SameLenAnnotatedTypeFactory
,SearchIndexAnnotatedTypeFactory
,SignatureAnnotatedTypeFactory
,SignednessAnnotatedTypeFactory
,SubstringIndexAnnotatedTypeFactory
,SubtypingAnnotatedTypeFactory
,TaintingAnnotatedTypeFactory
,TypeOutputtingChecker.GeneralAnnotatedTypeFactory
,UnitsAnnotatedTypeFactory
,UpperBoundAnnotatedTypeFactory
,ValueAnnotatedTypeFactory
public interface AnnotationProvider
An implementation of AnnotationProvider returns annotations on Java AST elements.
-
-
Method Summary
All Methods Instance Methods Abstract 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 or an alias of it, 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
@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 or an alias of it, used to annotate the element. Returns null if no annotation equivalent toanno
exists onelt
.- 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
@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.- 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
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.- Parameters:
methodElement
- a method- Returns:
- true if a call to the method does not undo flow-sensitive type refinement
-
-