public class KeyForPropagator extends Object
KeyForPropagationTreeAnnotator
Modifier and Type | Class and Description |
---|---|
static class |
KeyForPropagator.PropagationDirection |
Constructor and Description |
---|
KeyForPropagator(AnnotationMirror unknownKeyfor) |
Modifier and Type | Method and Description |
---|---|
void |
propagate(AnnotatedTypeMirror.AnnotatedDeclaredType subtype,
AnnotatedTypeMirror.AnnotatedDeclaredType supertype,
KeyForPropagator.PropagationDirection direction,
AnnotatedTypeFactory typeFactory)
Propagate annotations from the type arguments of one type to another.
|
void |
propagateNewClassTree(NewClassTree newClassTree,
AnnotatedTypeMirror type,
KeyForAnnotatedTypeFactory atypeFactory)
Propagate annotations from the type arguments of
type to the assignment context of
newClassTree if one exists. |
public KeyForPropagator(AnnotationMirror unknownKeyfor)
public void propagate(AnnotatedTypeMirror.AnnotatedDeclaredType subtype, AnnotatedTypeMirror.AnnotatedDeclaredType supertype, KeyForPropagator.PropagationDirection direction, AnnotatedTypeFactory typeFactory)
Note the primary annotations of subtype/supertype are not used.
Simple Example:
typeOf(subtype) = ArrayList<@KeyFor("a") String>
typeOf(supertype) = List<@UnknownKeyFor String>
direction = TO_SUPERTYPE
The type of supertype after propagate would be: List<@KeyFor("a") String>
A more complex example would be:
typeOf(subtype) = HashMap<@UnknownKeyFor String, @KeyFor("b") List<@KeyFor("c") String>>
typeOf(supertype) = Map<@KeyFor("a") String, @KeyFor("b") List<@KeyFor("c") String>>
direction = TO_SUBTYPE
The type of subtype after propagate would be: HashMap<@KeyFor("a")
String, @KeyFor("b") List<@KeyFor("c") String>>
public void propagateNewClassTree(NewClassTree newClassTree, AnnotatedTypeMirror type, KeyForAnnotatedTypeFactory atypeFactory)
type
to the assignment context of
newClassTree
if one exists.newClassTree
- new class treetype
- annotated type of newClassTree
atypeFactory
- factory