Class NewInsertion
java.lang.Object
org.checkerframework.afu.annotator.find.Insertion
org.checkerframework.afu.annotator.find.TypedInsertion
org.checkerframework.afu.annotator.find.NewInsertion
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.afu.annotator.find.Insertion
Insertion.Kind -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIf true, the type will be qualified with the name of the superclass.Fields inherited from class org.checkerframework.afu.annotator.find.TypedInsertion
annotationsOnly, innerTypeInsertions, typeFields inherited from class org.checkerframework.afu.annotator.find.Insertion
alwaysQualify, packageNames -
Constructor Summary
ConstructorsConstructorDescriptionNewInsertion(Type type, Criteria criteria, List<Insertion> innerTypeInsertions) Construct a NewInsertion. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaddLeadingSpace(boolean gotSeparateLine, int pos, char precedingChar) Indicates if a preceding space should be added to this insertion.protected booleanaddTrailingSpace(boolean gotSeparateLine) Indicates if a trailing space should be added to this insertion.getKind()Gets the kind of this insertion.protected StringgetText(boolean abbreviate) Gets the insertion text.voidsetQualifyType(boolean qualifyType) Iftrue, qualifytypewith the name of the superclass.Methods inherited from class org.checkerframework.afu.annotator.find.TypedInsertion
getBaseType, getBaseType, getInnerTypeInsertions, getType, setAnnotationsOnly, setTypeMethods inherited from class org.checkerframework.afu.annotator.find.Insertion
collectionToString, decorateType, decorateType, getAlwaysQualify, getCriteria, getPackageNames, getText, getText, isInserted, isSeparateLine, removePackage, setAlwaysQualify, setInserted, toString, toStringWithoutClass, typeToString
-
Field Details
-
qualifyType
protected boolean qualifyTypeIf true, the type will be qualified with the name of the superclass.
-
-
Constructor Details
-
NewInsertion
Construct a NewInsertion.If "new" already exists in the initializer, then pass a
DeclaredTypethats name is the empty String. This will only insert an annotation on the existing type.To insert the annotation along with "new" and the type (for example,
@Anno new Type[] \{...\}), set the name to the type to insert. This can be done either before calling this constructor, or by modifying the return value ofTypedInsertion.getType().- Parameters:
type- the type to use when inserting the receivercriteria- where to insert the textinnerTypeInsertions- the inner types to go on this receiver
-
-
Method Details
-
getText
Description copied from class:InsertionGets the insertion text.- Specified by:
getTextin classInsertion- Parameters:
abbreviate- if true, the package name will be removed from the annotations. The package name can be retrieved again by calling theInsertion.getPackageNames()method.- Returns:
- the text to insert
-
setQualifyType
public void setQualifyType(boolean qualifyType) Iftrue, qualifytypewith the name of the superclass. This will only happen if a "new" is inserted. -
addLeadingSpace
protected boolean addLeadingSpace(boolean gotSeparateLine, int pos, char precedingChar) Description copied from class:InsertionIndicates if a preceding space should be added to this insertion. Subclasses may override this method for custom leading space rules.- Overrides:
addLeadingSpacein classInsertion- Parameters:
gotSeparateLine-trueif this insertion is actually added on a separate linepos- the source position where this insertion will be insertedprecedingChar- the character directly preceding where this insertion will be inserted. This value will be ignored ifposis 0.- Returns:
trueif a leading space should be added,falseotherwise
-
addTrailingSpace
protected boolean addTrailingSpace(boolean gotSeparateLine) Description copied from class:InsertionIndicates if a trailing space should be added to this insertion. Subclasses may override this method for custom trailing space rules.- Overrides:
addTrailingSpacein classInsertion- Parameters:
gotSeparateLine-trueif this insertion is actually added on a separate line- Returns:
- true if a trailing space should be added,
falseotherwise
-
getKind
Description copied from class:InsertionGets the kind of this insertion.
-