public class TypeDeclarationApplier
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected javax.lang.model.element.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,
javax.lang.model.element.Element element) |
protected com.sun.tools.javac.code.TargetType[] |
annotatedTargets() |
static void |
apply(AnnotatedTypeMirror type,
javax.lang.model.element.Element element,
AnnotatedTypeFactory typeFactory) |
void |
extractAndApply()
Adds extends/implements and class annotations to type.
|
protected java.lang.Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> |
getRawTypeAttributes()
All TypeCompounds (annotations) on the ClassSymbol.
|
protected void |
handleInvalid(java.util.List<com.sun.tools.javac.code.Attribute.TypeCompound> invalid) |
protected void |
handleTargeted(java.util.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(java.util.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 java.util.Map<org.checkerframework.framework.util.element.TargetedElementAnnotationApplier.TargetClass,java.util.List<com.sun.tools.javac.code.Attribute.TypeCompound>> |
sift(java.lang.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 javax.lang.model.element.Element element
public static void apply(AnnotatedTypeMirror type, javax.lang.model.element.Element element, AnnotatedTypeFactory typeFactory) throws ElementAnnotationUtil.UnexpectedAnnotationLocationException
public static boolean accepts(AnnotatedTypeMirror type, javax.lang.model.element.Element element)
protected com.sun.tools.javac.code.TargetType[] validTargets()
protected com.sun.tools.javac.code.TargetType[] annotatedTargets()
protected java.lang.Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> getRawTypeAttributes()
protected void handleTargeted(java.util.List<com.sun.tools.javac.code.Attribute.TypeCompound> extendsAndImplementsAnnos) throws ElementAnnotationUtil.UnexpectedAnnotationLocationException
extendsAndImplementsAnnos
- annotations with a TargetType of CLASS_EXTENDSElementAnnotationUtil.UnexpectedAnnotationLocationException
public void extractAndApply() throws ElementAnnotationUtil.UnexpectedAnnotationLocationException
protected boolean isAccepted()
protected void handleValid(java.util.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(java.util.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 java.util.Map<org.checkerframework.framework.util.element.TargetedElementAnnotationApplier.TargetClass,java.util.List<com.sun.tools.javac.code.Attribute.TypeCompound>> sift(java.lang.Iterable<com.sun.tools.javac.code.Attribute.TypeCompound> typeCompounds)
typeCompounds
- annotations to sift through, should be those returned by
getRawTypeAttributes