Class AnnotatedTypeCopier

java.lang.Object
org.checkerframework.framework.type.AnnotatedTypeCopier
All Implemented Interfaces:
AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
Direct Known Subclasses:
AnnotatedTypeCopierWithReplacement.Visitor, AnnotatedTypeFactory.CapturedTypeVarSubstitutor, TypeVariableSubstitutor.Visitor

AnnotatedTypeCopier is a visitor that deep copies an AnnotatedTypeMirror exactly, including any lazily initialized fields. That is, if a field has already been initialized, it will be initialized in the copied type.

When making copies, a map of encountered references => copied types is maintained. This ensures that, if a reference appears in multiple locations in the original type, a corresponding copy of the original type appears in the same locations in the output copy. This ensures that the recursive loops in the input type are preserved in its output copy (see makeOrReturnCopy)

In general, AnnotatedTypeMirrors should be copied via AnnotatedTypeMirror#deepCopy and AnnotatedTypeMirror#shallowCopy. AnnotatedTypeMirror#deepCopy makes use of AnnotatedTypeCopier under the covers. However, this visitor and its subclasses can be invoked as follows:

new AnnotatedTypeCopier().visit(myTypeVar);
Note: There are methods that may require a copy of a type mirror with slight changes. It is intended that this class can be overridden for these cases.
See Also: