Skip to content

Commit

Permalink
Documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed May 1, 2023
1 parent 1cf92f4 commit 025d4bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class CalledMethodsAnnotatedTypeFactory extends AccumulationAnnotatedType
*/
public CalledMethodsAnnotatedTypeFactory(BaseTypeChecker checker) {
super(checker, CalledMethods.class, CalledMethodsBottom.class, CalledMethodsPredicate.class);

this.builderFrameworkSupports = new ArrayList<>(2);
String[] disabledFrameworks;
if (checker.hasOption(CalledMethodsChecker.DISABLE_BUILDER_FRAMEWORK_SUPPORTS)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ public AnnotatedTypeMirror getParameterTypeInitialized(
/**
* Adds a declaration annotation to this parameter and returns whether it was a new annotation.
*
* @param annotation declaration annotation to add
* @param annotation the declaration annotation to add
* @param index index of the parameter
* @return true if {@code annotation} wasn't previously stored for this parameter
*/
Expand Down Expand Up @@ -1553,7 +1553,7 @@ public AnnotationMirrorSet getDeclarationAnnotations() {
* Adds a declaration annotation to this callable declaration and returns whether it was a new
* annotation.
*
* @param annotation declaration annotation to add
* @param annotation the declaration annotation to add
* @return true if {@code annotation} wasn't previously stored for this callable declaration
*/
public boolean addDeclarationAnnotation(AnnotationMirror annotation) {
Expand All @@ -1580,12 +1580,17 @@ public boolean addDeclarationAnnotation(AnnotationMirror annotation) {
}

/**
* Returns the inferred preconditions for this callable declaration.
* Returns the inferred preconditions for this callable declaration. The keys of the returned
* map use the same string formatting as the {@link
* org.checkerframework.framework.qual.RequiresQualifier} annotation, e.g. "#1" for the first
* parameter.
*
* @return a mapping from expression string to pairs of (inferred precondition, declared type).
* The keys of this map use the same string formatting as the {@link
* org.checkerframework.framework.qual.RequiresQualifier} annotation, e.g. "#1" for the
* first parameter.
* <p>Although the map is immutable, the AnnotatedTypeMirrors within it can be modified, and
* such changes will be reflected in the receiver CallableDeclarationAnnos object.
*
* @return a mapping from Java expression string to pairs of (inferred precondition for the
* expression, declared type of the expression)
* @see #getPreconditionsForExpression
*/
public Map<String, Pair<AnnotatedTypeMirror, AnnotatedTypeMirror>> getPreconditions() {
if (preconditions == null) {
Expand All @@ -1596,12 +1601,17 @@ public Map<String, Pair<AnnotatedTypeMirror, AnnotatedTypeMirror>> getPreconditi
}

/**
* Returns the inferred postconditions for this callable declaration.
* Returns the inferred postconditions for this callable declaration. The keys of the returned
* map use the same string formatting as the {@link
* org.checkerframework.framework.qual.EnsuresQualifier} annotation, e.g. "#1" for the first
* parameter.
*
* <p>Although the map is immutable, the AnnotatedTypeMirrors within it can be modified, and
* such changes will be reflected in the receiver CallableDeclarationAnnos object.
*
* @return a mapping from expression string to pairs of (inferred postcondition, declared type).
* The keys of this map use the same string formatting as the {@link
* org.checkerframework.framework.qual.EnsuresQualifier} annotation, e.g. "#1" for the first
* parameter.
* @return a mapping from Java expression string to pairs of (inferred postcondition for the
* expression, declared type of the expression)
* @see #getPostconditionsForExpression
*/
public Map<String, Pair<AnnotatedTypeMirror, AnnotatedTypeMirror>> getPostconditions() {
if (postconditions == null) {
Expand All @@ -1612,7 +1622,8 @@ public Map<String, Pair<AnnotatedTypeMirror, AnnotatedTypeMirror>> getPostcondit
}

/**
* Returns an AnnotatedTypeMirror containing the preconditions for the given expression.
* Returns an AnnotatedTypeMirror containing the preconditions for the given expression. Changes
* to the returned AnnotatedTypeMirror are reflected in this CallableDeclarationAnnos.
*
* @param expression a string representing a Java expression, in the same format as the argument
* to a {@link org.checkerframework.framework.qual.RequiresQualifier} annotation
Expand All @@ -1639,6 +1650,7 @@ public AnnotatedTypeMirror getPreconditionsForExpression(

/**
* Returns an AnnotatedTypeMirror containing the postconditions for the given expression.
* Changes to the returned AnnotatedTypeMirror are reflected in this CallableDeclarationAnnos.
*
* @param expression a string representing a Java expression, in the same format as the argument
* to a {@link org.checkerframework.framework.qual.EnsuresQualifier} annotation
Expand Down

0 comments on commit 025d4bb

Please sign in to comment.