Class FormatterTreeUtil.FormatCall
- java.lang.Object
-
- org.checkerframework.checker.formatter.FormatterTreeUtil.FormatCall
-
- Enclosing class:
- FormatterTreeUtil
public class FormatterTreeUtil.FormatCall extends java.lang.Object
Represents a format method invocation in the syntax tree.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable FormatterTreeUtil.Result<java.lang.String>
errMissingFormatAnnotation()
Returns an error description if the format-string argument's type is not annotated as@Format
.FormatterTreeUtil.Result<javax.lang.model.type.TypeMirror>[]
getArgTypes()
Returns the types of the arguments to the call.ConversionCategory[]
getFormatCategories()
Returns the conversion category for every parameter.FormatterTreeUtil.Result<FormatterTreeUtil.InvocationType>
getInvocationType()
Returns the type of method invocation.boolean
isArgumentNull(javax.lang.model.type.TypeMirror type)
Checks if the argument returned fromgetArgTypes()
is anull
expression.boolean
isValidArgument(ConversionCategory formatCat, javax.lang.model.type.TypeMirror argType)
Checks if the type of an argument returned fromgetArgTypes()
is valid for the passed ConversionCategory.
-
-
-
Method Detail
-
errMissingFormatAnnotation
public final @Nullable FormatterTreeUtil.Result<java.lang.String> errMissingFormatAnnotation()
Returns an error description if the format-string argument's type is not annotated as@Format
. Returns null if it is annotated.- Returns:
- an error description if the format string is not annotated as
@Format
, or null if it is
-
getInvocationType
public final FormatterTreeUtil.Result<FormatterTreeUtil.InvocationType> getInvocationType()
Returns the type of method invocation.- See Also:
FormatterTreeUtil.InvocationType
-
getFormatCategories
public final ConversionCategory[] getFormatCategories()
Returns the conversion category for every parameter.- Returns:
- the conversion categories of all the parameters
- See Also:
ConversionCategory
-
getArgTypes
public final FormatterTreeUtil.Result<javax.lang.model.type.TypeMirror>[] getArgTypes()
Returns the types of the arguments to the call. UseisValidArgument(org.checkerframework.checker.formatter.qual.ConversionCategory, javax.lang.model.type.TypeMirror)
andisArgumentNull(javax.lang.model.type.TypeMirror)
to work with the result.- Returns:
- the types of the arguments to the call
-
isValidArgument
public final boolean isValidArgument(ConversionCategory formatCat, javax.lang.model.type.TypeMirror argType)
Checks if the type of an argument returned fromgetArgTypes()
is valid for the passed ConversionCategory.- Parameters:
formatCat
- a format specifierargType
- an argument type- Returns:
- true if the argument can be passed to the format specifier
-
isArgumentNull
public final boolean isArgumentNull(javax.lang.model.type.TypeMirror type)
Checks if the argument returned fromgetArgTypes()
is anull
expression.- Parameters:
type
- a type- Returns:
- true if the argument is a
null
expression
-
-