Class TypedInsertion
java.lang.Object
org.checkerframework.afu.annotator.find.Insertion
org.checkerframework.afu.annotator.find.TypedInsertion
- Direct Known Subclasses:
ConstructorInsertion,NewInsertion,ReceiverInsertion
An insertion that may result in code generation other than just annotations.
TypedInsertions keep track of insertions on inner types. If there is no type given in the
source, one may be generated (along with other code necessary in the context) to serve as an
insertion site.
We don't know until the end of the whole insertion process whether the type already exists or
not. To remedy this, we store a reference to each insertion on an inner type of a receiver in two
places: the global list of all insertions and the TypedInsertion that is the parent of
the inner type insertion. If the type is not already present, the inner type insertions are
inserted into the new type and labeled as "inserted" (with Insertion.setInserted(boolean)) so they are not inserted as the rest of the insertions list is
processed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.afu.annotator.find.Insertion
Insertion.Kind -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIf true only the annotations fromtypewill be inserted.The inner types to go on this insertion.protected TypeThe type for insertion.Fields inherited from class org.checkerframework.afu.annotator.find.Insertion
alwaysQualify, packageNames -
Constructor Summary
ConstructorsConstructorDescriptionTypedInsertion(Type type, Criteria criteria, boolean b, List<Insertion> innerTypeInsertions) TypedInsertion(Type type, Criteria criteria, List<Insertion> innerTypeInsertions) -
Method Summary
Modifier and TypeMethodDescriptionstatic DeclaredTypegetBaseType(Type type) Gets the inner type insertions associated with this insertion.getType()Gets the type.voidsetAnnotationsOnly(boolean annotationsOnly) Iftrueonly the annotations ontypewill be inserted.voidSets the type.Methods inherited from class org.checkerframework.afu.annotator.find.Insertion
addLeadingSpace, addTrailingSpace, collectionToString, decorateType, decorateType, getAlwaysQualify, getCriteria, getKind, getPackageNames, getText, getText, getText, isInserted, isSeparateLine, removePackage, setAlwaysQualify, setInserted, toString, toStringWithoutClass, typeToString
-
Field Details
-
type
The type for insertion. -
annotationsOnly
protected boolean annotationsOnlyIf true only the annotations fromtypewill be inserted. -
innerTypeInsertions
The inner types to go on this insertion. SeeReceiverInsertionfor more details.
-
-
Constructor Details
-
TypedInsertion
-
TypedInsertion
-
-
Method Details
-
setAnnotationsOnly
public void setAnnotationsOnly(boolean annotationsOnly) Iftrueonly the annotations ontypewill be inserted. This is useful when the "new" has already been inserted. -
setType
Sets the type. -
getType
Gets the type. It is assumed that the returned value will be modified to update the type to be inserted. -
getInnerTypeInsertions
Gets the inner type insertions associated with this insertion.- Returns:
- a copy of the inner types
-
getBaseType
-
getBaseType
-