public class TypeDeclarationApplier extends Object
Modifier and Type | Field and Description |
---|---|
protected Element |
element
An Element that type represents.
|
static int |
SUPERCLASS_INDEX
If a type_index == -1 it means that the index refers to the immediate supertype class of the
declaration.
|
protected AnnotatedTypeMirror |
type
The type to which we wish to apply annotations.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
accepts(AnnotatedTypeMirror type,
Element element) |
protected com.sun.tools.javac.code.TargetType[] |
annotatedTargets() |
static void |
apply(AnnotatedTypeMirror type,
Element element,
AnnotatedTypeFactory typeFactory) |
void |
extractAndApply()
Adds extends/implements and class annotations to type.
|
protected Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> |
getRawTypeAttributes()
All TypeCompounds (annotations) on the ClassSymbol
|
protected void |
handleInvalid(List<com.sun.tools.javac.code.Attribute.TypeCompound> invalid) |
protected void |
handleTargeted(List<com.sun.tools.javac.code.Attribute.TypeCompound> extendsAndImplementsAnnos)
While more than just annotations on extends or implements clause are annotated by this class,
only these annotations are passed to handleTargeted (as they are the only in the
annotatedTargets list).
|
protected void |
handleValid(List<com.sun.tools.javac.code.Attribute.TypeCompound> valid)
The default implementation of this method does nothing.
|
protected boolean |
isAccepted()
Tests element/type fields to ensure that this TargetedElementAnnotationApplier is valid for
this element/type pair.
|
protected Map<org.checkerframework.framework.util.element.TargetedElementAnnotationApplier.TargetClass,List<com.sun.tools.javac.code.Attribute.TypeCompound>> |
sift(Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> typeCompounds)
Separate the input annotations into a Map of TargetClass (TARGETED, VALID, INVALID) to the
annotations that fall into each of those categories.
|
protected com.sun.tools.javac.code.TargetType[] |
validTargets() |
public static final int SUPERCLASS_INDEX
protected final AnnotatedTypeMirror type
protected final Element element
public static void apply(AnnotatedTypeMirror type, Element element, AnnotatedTypeFactory typeFactory)
public static boolean accepts(AnnotatedTypeMirror type, Element element)
protected com.sun.tools.javac.code.TargetType[] validTargets()
protected com.sun.tools.javac.code.TargetType[] annotatedTargets()
protected Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> getRawTypeAttributes()
protected void handleTargeted(List<com.sun.tools.javac.code.Attribute.TypeCompound> extendsAndImplementsAnnos)
extendsAndImplementsAnnos
- annotations with a TargetType of CLASS_EXTENDSpublic void extractAndApply()
protected boolean isAccepted()
protected void handleValid(List<com.sun.tools.javac.code.Attribute.TypeCompound> valid)
valid
- the list of annotations that were returned by getRawTypeAttributes and had a
TargetType contained by valid and NOT annotatedTargetsprotected void handleInvalid(List<com.sun.tools.javac.code.Attribute.TypeCompound> invalid)
invalid
- the list of annotations that were returned by getRawTypeAttributes and were
not handled by handleTargeted or handleValidprotected Map<org.checkerframework.framework.util.element.TargetedElementAnnotationApplier.TargetClass,List<com.sun.tools.javac.code.Attribute.TypeCompound>> sift(Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> typeCompounds)
typeCompounds
- annotations to sift through, should be those returned by
getRawTypeAttributes