public class WholeProgramInferenceJavaParserStorage.CallableDeclarationAnnos extends Object
Modifier and Type | Field and Description |
---|---|
com.github.javaparser.ast.body.CallableDeclaration<?> |
declaration
Wrapped method or constructor declaration.
|
String |
file
Path to file containing the declaration.
|
Constructor and Description |
---|
CallableDeclarationAnnos(com.github.javaparser.ast.body.CallableDeclaration<?> declaration)
Creates a wrapper for the given method or constructor declaration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDeclarationAnnotation(AnnotationMirror annotation)
Adds a declaration annotation to this callable declaration and returns whether it was a new
annotation.
|
Set<AnnotationMirror> |
getDeclarationAnnotations()
Returns the inferred declaration annotations on this executable, or null if there are no
annotations.
|
Map<VariableElement,AnnotatedTypeMirror> |
getFieldToPostconditions()
Returns the inferred postconditions for this callable declaration.
|
Map<VariableElement,AnnotatedTypeMirror> |
getFieldToPreconditions()
Returns the inferred preconditions for this callable declaration.
|
@Nullable AnnotatedTypeMirror |
getParameterType(int index)
Returns the inferred type for the parameter at the given index, or null if there's no
parameter at the given index or there's no inferred type for that parameter.
|
AnnotatedTypeMirror |
getParameterTypeInitialized(AnnotatedTypeMirror type,
int index,
AnnotatedTypeFactory atf)
Returns the inferred type for the parameter at the given index.
|
AnnotatedTypeMirror |
getPostconditionsForField(VariableElement field,
AnnotatedTypeFactory atf)
Returns an AnnotatedTypeMirror containing the postconditions for the given field.
|
AnnotatedTypeMirror |
getPreconditionsForField(VariableElement field,
AnnotatedTypeFactory atf)
Returns an AnnotatedTypeMirror containing the preconditions for the given field.
|
AnnotatedTypeMirror |
getReceiverType(AnnotatedTypeMirror type,
AnnotatedTypeFactory atf)
If this wrapper holds a method, returns the inferred type of the receiver.
|
AnnotatedTypeMirror |
getReturnType(AnnotatedTypeMirror type,
AnnotatedTypeFactory atf)
If this wrapper holds a method, returns the inferred type of the return type.
|
String |
toString() |
void |
transferAnnotations()
Transfers all annotations inferred by whole program inference for the return type, receiver
type, and parameter types for the wrapped declaration to their corresponding JavaParser
locations.
|
public com.github.javaparser.ast.body.CallableDeclaration<?> declaration
public String file
public CallableDeclarationAnnos(com.github.javaparser.ast.body.CallableDeclaration<?> declaration)
declaration
- method or constructor declaration to wrappublic AnnotatedTypeMirror getParameterTypeInitialized(AnnotatedTypeMirror type, int index, AnnotatedTypeFactory atf)
AnnotatedTypeMirror
for that location using type
and atf
to a wrapper
around the base type for the parameter.type
- type for the parameter at index
, used for initializing the returned
AnnotatedTypeMirror
the first time it's accessedatf
- the annotated type factory of a given type system, whose type hierarchy will be
usedindex
- index of the parameter to return the inferred annotations ofAnnotatedTypeMirror
containing all annotations inferred for the parameter
at the given indexpublic @Nullable AnnotatedTypeMirror getParameterType(int index)
index
- index of the parameter to return the inferred annotations ofAnnotatedTypeMirror
containing all annotations inferred for the parameter
at the given index, or null if there's no parameter at index
or if there's not
inferred annotations for that parameterpublic Set<AnnotationMirror> getDeclarationAnnotations()
public boolean addDeclarationAnnotation(AnnotationMirror annotation)
annotation
- declaration annotation to addannotation
wasn't previously stored for this callable declarationpublic AnnotatedTypeMirror getReceiverType(AnnotatedTypeMirror type, AnnotatedTypeFactory atf)
AnnotatedTypeMirror
for that location using type
and atf
to a wrapper around the base type for the receiver type.type
- base type for the receiver type, used for initializing the returned AnnotatedTypeMirror
the first time it's accessedatf
- the annotated type factory of a given type system, whose type hierarchy will be
usedAnnotatedTypeMirror
containing all annotations inferred for the receiver
typepublic AnnotatedTypeMirror getReturnType(AnnotatedTypeMirror type, AnnotatedTypeFactory atf)
AnnotatedTypeMirror
for that location using type
and atf
to a wrapper around the base type for the return type.type
- base type for the return type, used for initializing the returned AnnotatedTypeMirror
the first time it's accessedatf
- the annotated type factory of a given type system, whose type hierarchy will be
usedAnnotatedTypeMirror
containing all annotations inferred for the return
typepublic Map<VariableElement,AnnotatedTypeMirror> getFieldToPreconditions()
public Map<VariableElement,AnnotatedTypeMirror> getFieldToPostconditions()
public AnnotatedTypeMirror getPreconditionsForField(VariableElement field, AnnotatedTypeFactory atf)
field
- VariableElement for a field in the enclosing class for this methodatf
- the annotated type factory of a given type system, whose type hierarchy will be
usedAnnotatedTypeMirror
containing the annotations for the inferred
preconditions for the given fieldpublic AnnotatedTypeMirror getPostconditionsForField(VariableElement field, AnnotatedTypeFactory atf)
field
- VariableElement for a field in the enclosing class for this methodatf
- the annotated type factory of a given type system, whose type hierarchy will be
usedAnnotatedTypeMirror
containing the annotations for the inferred
postconditions for the given fieldpublic void transferAnnotations()