Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public static List<Integer> getLengthsForStringValues(List<String> values) {

/**
* Finds the maximum value in a Value Checker type. If there is no information (such as when the
* list of possible values is empty or null), returns null. Otherwise, returns the smallest value
* list of possible values is empty or null), returns null. Otherwise, returns the largest value
* in the list of possible values.
*/
public static @Nullable Long getMaxValue(Tree tree, ValueAnnotatedTypeFactory factory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public AnnotatedTypeFactory(BaseTypeChecker checker) {
* That is, no element has a {@code @Target} meta-annotation that contains something besides
* TYPE_USE or TYPE_PARAMETER. ({@code @Target({})} is allowed.)
*
* @throws BugInCF If supportedQuals is empty or contaions a non-type qualifier
* @throws TypeSystemError if supportedQuals is empty or contains a non-type qualifier
*/
private void checkSupportedQualsAreTypeQuals() {
if (supportedQuals == null || supportedQuals.isEmpty()) {
Expand Down Expand Up @@ -1893,7 +1893,7 @@ public void postAsMemberOf(AnnotatedTypeMirror type, AnnotatedTypeMirror owner,
*
* @param type annotated type to which the annotation is added
* @param accessedVia the annotated type of the receiver of the accessing tree. (Only used to get
* the type element of the underling type.)
* the type element of the underlying type.)
* @param field element representing the field
*/
protected void addAnnotationFromFieldInvariant(
Expand Down Expand Up @@ -2652,11 +2652,11 @@ protected void adaptGetClassReturnTypeToReceiver(

/**
* Returns the element type of {@code expression}. This is usually the type of {@code
* expression.itertor().next()}. If {@code expression} is an array, it is the component type of
* expression.iterator().next()}. If {@code expression} is an array, it is the component type of
* the array.
*
* @param expression an expression whose type is an array or implements {@link Iterable}
* @return the type of {@code expression.itertor().next()} or if {@code expression} is an array,
* @return the type of {@code expression.iterator().next()} or if {@code expression} is an array,
* the component type of the array
*/
public AnnotatedTypeMirror getIterableElementType(ExpressionTree expression) {
Expand All @@ -2665,12 +2665,12 @@ public AnnotatedTypeMirror getIterableElementType(ExpressionTree expression) {

/**
* Returns the element type of {@code iterableType}. This is usually the type of {@code
* expression.itertor().next()}. If {@code expression} is an array, it is the component type of
* expression.iterator().next()}. If {@code expression} is an array, it is the component type of
* the array.
*
* @param expression an expression whose type is an array or implements {@link Iterable}
* @param iterableType the type of the expression
* @return the type of {@code expression.itertor().next()} or if {@code expression} is an array,
* @return the type of {@code expression.iterator().next()} or if {@code expression} is an array,
* the component type of the array
*/
protected AnnotatedTypeMirror getIterableElementType(
Expand Down Expand Up @@ -4007,7 +4007,7 @@ public boolean shouldWarnIfStubRedundantWithBytecode() {
*
* @param elt the element to retrieve the annotation from
* @param annoClass the class of the annotation to retrieve
* @param checkAliases if true, the metnhod may return an annotation mirror for an alias of the
* @param checkAliases if true, the method may return an annotation mirror for an alias of the
* requested annotation class name
* @return the annotation mirror for the requested annotation, or null if not found
*/
Expand Down Expand Up @@ -4767,7 +4767,7 @@ private AnnotatedTypeMirror getFunctionalInterfaceType(Tree tree) {
*
* @param typeMirror a type that must be a functional interface
* @param contextTree the tree that has the given type; used only for diagnostic messages
* @param tree a labmba tree that encloses {@code contextTree}; used only for diagnostic messages
* @param tree a lambda tree that encloses {@code contextTree}; used only for diagnostic messages
*/
private void assertIsFunctionalInterface(TypeMirror typeMirror, Tree contextTree, Tree tree) {
if (typeMirror.getKind() == TypeKind.WILDCARD) {
Expand Down Expand Up @@ -5787,7 +5787,7 @@ public boolean doesAnnotatedForApplyToThisChecker(AnnotationMirror annotatedForA
* Returns the {@code expression} field/element of the given contract annotation.
*
* @param contractAnno a {@link RequiresQualifier}, {@link EnsuresQualifier}, or {@link
* EnsuresQualifier}
* EnsuresQualifierIf}
* @return the {@code expression} field/element of the given annotation
*/
public List<String> getContractExpressions(AnnotationMirror contractAnno) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public boolean hasPrimaryAnnotationInHierarchy(AnnotationMirror annotation) {
* #getAnnotationInHierarchy(AnnotationMirror)} should be called instead.
*
* @param annotation an annotation in the qualifier hierarchy to check for
* @return the annotation mirror whose class is named {@code annoNAme} or null
* @return the annotation in the same hierarchy as {@code annotation}, or null
*/
public @Nullable AnnotationMirror getPrimaryAnnotationInHierarchy(AnnotationMirror annotation) {
if (primaryAnnotations.isEmpty()) {
Expand Down Expand Up @@ -377,7 +377,7 @@ public AnnotationMirrorSet getAnnotations() {
* <p>This method requires that there is only a single hierarchy. Therefore, it is equivalent to
* {@link #getAnnotationInHierarchy(AnnotationMirror)}.
*
* @return a set of the annotations on this
* @return the annotation on this type, or null if there is none
*/
public final AnnotationMirror getAnnotation() {
AnnotationMirrorSet effectiveAnnotations = getAnnotations();
Expand All @@ -386,7 +386,7 @@ public final AnnotationMirror getAnnotation() {
return null;
}
if (effectiveAnnotations.size() != 1) {
throw new BugInCF("Bad annotation size for getPrimaryAnnotation(): " + this);
throw new BugInCF("Bad annotation size for getAnnotation(): " + this);
}
return effectiveAnnotations.iterator().next();
}
Expand Down Expand Up @@ -669,7 +669,7 @@ public void addAnnotations(Iterable<? extends AnnotationMirror> annotations) {
* {@link AnnotatedIntersectionType}s, adds them to all bounds. (The canonical version is found
* via {@link AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror)} or {@link
* AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror,TypeMirror)}.) If the canonical
* version of an annotation is not a supported qualifier, then that annotation is not add added.
* version of an annotation is not a supported qualifier, then that annotation is not added.
*
* @param annotations the annotations to add
*/
Expand All @@ -688,7 +688,7 @@ public void addMissingAnnotations(Iterable<? extends AnnotationMirror> annotatio
* {@link AnnotatedIntersectionType}s) added to all bounds. (The canonical version is found via
* {@link AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror)} or {@link
* AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror,TypeMirror)}.) If the canonical
* version of an {@code annotation} is not a supported qualifier, then that annotation is not add
* version of an {@code annotation} is not a supported qualifier, then that annotation is not
* added.
*
* @param annotation the annotations to add
Expand Down Expand Up @@ -1741,9 +1741,9 @@ public TypeVariable getUnderlyingType() {
/**
* Set the lower bound of this variable type.
*
* <p>Returns the lower bound of this type variable. While a type parameter cannot include an
* explicit lower bound declaration, capture conversion can produce a type variable with a
* non-trivial lower bound. Type variables otherwise have a lower bound of NullType.
* <p>While a type parameter cannot include an explicit lower bound declaration, capture
* conversion can produce a type variable with a non-trivial lower bound. Type variables
* otherwise have a lower bound of NullType.
*
* @param type the lower bound type
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public boolean equals(@Nullable Object obj) {
if (!(obj instanceof AnnotatedTypeParameterBounds other)) {
return false;
}
return this.upper == null
? other.upper == null
: (this.upper.equals(other.upper) && this.lower == null)
? other.lower == null
: this.lower.equals(other.lower);
return Objects.equals(this.upper, other.upper) && Objects.equals(this.lower, other.lower);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private AnnotatedTypeMirror copyPrimaryAnnos(AnnotatedTypeMirror from, Annotated
* A helper method for asSuper(AMT, Wildcard) methods to use to annotate the wildcard's lower
* bound.
*
* <p>If the lower bound of superType is Null, then return copyPrimarayAnnos(type, superType)
* <p>If the lower bound of superType is Null, then return copyPrimaryAnnos(type, superType)
*
* <p>otherwise, return asSuper(type, superType.getLowerBound()
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private void initializeTypeVariable(AnnotatedTypeVariable annotatedTypeVariable)
/**
* Sets the extends and super bounds of {@code annotatedWildcardType} to {@code
* AnnotatedTypeMirror} that match the upper and lower bounds of the underlying type of {@code
* annotatedWildcardType} by calling visiting each bound. This method should only be called once
* per {@link WildcardType}.
* annotatedWildcardType} by visiting each bound. This method should only be called once per
* {@link WildcardType}.
*
* @param annotatedWildcardType an annotated wildcard type
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private DeclarationsIntoElements() {
/**
* The entry point.
*
* @param env the processing environment
* @param atypeFactory the type factory
* @param tree the ClassTree to process
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected static class FormattingVisitor
/**
* For a given call to format, this setting specifies whether or not to printInvisibles. If a
* user did not specify a printInvisible parameter in the call to format then this value will
* equal DefaultAnnotatedTypeFormatter.defaultInvisibleSettings for this object
* equal DefaultAnnotatedTypeFormatter.defaultInvisiblesSetting for this object
*/
protected boolean currentPrintInvisibleSetting;

Expand All @@ -148,7 +148,7 @@ protected static class FormattingVisitor

/**
* Prints type variables in a less ambiguous manner using [] to delimit them. Always prints both
* bounds even if they lower bound is an AnnotatedNull type.
* bounds even if the lower bound is an AnnotatedNull type.
*/
protected boolean currentPrintVerboseGenerics;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public Boolean visitWildcard_Wildcard(
*
* @param subtype the possible subtype
* @param supertype the possible supertype
* @return true {@code subtype} is a subtype of {@code supertype}
* @return true if {@code subtype} is a subtype of {@code supertype}
*/
protected boolean visitType_Intersection(
AnnotatedTypeMirror subtype, AnnotatedIntersectionType supertype) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ public static void apply(
}
}

/** Issues an "invalid.annotation.location.bytecode warning. */
/**
* Issues an "invalid.annotation.location.bytecode" warning.
*
* @param element the location at which to report the warning
* @param typeFactory the factory that reports the warning
*/
private static void reportInvalidLocation(Element element, AnnotatedTypeFactory typeFactory) {
Element report = element;
if (element.getEnclosingElement().getKind() == ElementKind.METHOD) {
Expand Down Expand Up @@ -183,6 +188,7 @@ public static void annotateSupers(
* has been placed here.
*
* @param varEle the element that may represent a lambda's parameter
* @param typeFactory the type factory
* @return a LambdaExpressionTree if the varEle represents a parameter in a lambda expression,
* otherwise null
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@AnnotatedFor("nullness")
public abstract class ElementQualifierHierarchy extends QualifierHierarchy {

/** {@link org.checkerframework.javacutil.ElementUtils}. */
/** The {@link javax.lang.model.util.Elements} instance. */
private final Elements elements;

/** {@link QualifierKindHierarchy}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ protected boolean arePrimaryAnnosEqual(AnnotatedTypeMirror type1, AnnotatedTypeM
}

/**
* Returns true if the twe types are the same.
* Returns true if the two types are the same.
*
* @param type1 the first type to compare
* @param type2 the second type to compare
* @return true if the twe types are the same
* @return true if the two types are the same
*/
@EqualsMethod // to make Interning Checker permit the == comparison
protected boolean compare(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ private void clearSharedCFG(GenericAnnotatedTypeFactory<?, ?, ?, ?> factory) {
/**
* Returns an immutable set of the <em>monotonic</em> type qualifiers supported by this checker.
*
* @return the monotonic type qualifiers supported this processor, or an empty set if none
* @return the monotonic type qualifiers supported by this processor, or an empty set if none
* @see MonotonicQualifier
*/
public final Set<Class<? extends Annotation>> getSupportedMonotonicTypeQualifiers() {
Expand Down Expand Up @@ -1130,9 +1130,7 @@ protected enum ScanState {
protected final IdentityHashMap<MethodTree, List<IPair<ReturnNode, TransferResult<Value, Store>>>>
returnStatementStores;

/**
* A mapping from methods to their a list with all return statements and the corresponding store.
*/
/** A mapping from a method invocation to its corresponding store. */
protected IdentityHashMap<MethodInvocationTree, Store> methodInvocationStores;

/**
Expand Down Expand Up @@ -2613,8 +2611,7 @@ protected boolean isRelevantImpl(TypeMirror tm) {
return false;
}

default ->
throw new BugInCF("isRelevantHelper(%s): Unexpected TypeKind %s", tm, tm.getKind());
default -> throw new BugInCF("isRelevantImpl(%s): Unexpected TypeKind %s", tm, tm.getKind());
}
}

Expand Down Expand Up @@ -3098,8 +3095,8 @@ public boolean addSharedCFGForTree(Tree tree, ControlFlowGraph cfg) {
* @param kind the kind of {@code contractAnnotation}
* @param contractAnnotation a {@link RequiresQualifier}, {@link EnsuresQualifier}, or {@link
* EnsuresQualifierIf}
* @return the {@code result} element of {@code contractAnnotation}, or null if it doesn't have a
* {@code result} element
* @return the {@code expression} or {@code value} element of {@code contractAnnotation}, or null
* if it doesn't have one
*/
public @Nullable List<String> getContractExpressions(
Contract.Kind kind, AnnotationMirror contractAnnotation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* <p>This class should be synchronized with EqualityAtmComparer.
*
* @see org.checkerframework.framework.type.EqualityAtmComparer for more details.
* <p>This is used by AnnotatedTypeMirror.hashcode.
* <p>This is used by AnnotatedTypeMirror.hashCode.
*/
public class HashcodeAtmVisitor extends SimpleAnnotatedTypeScanner<Integer, Void> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ protected abstract AnnotationMirror leastUpperBoundWithElements(
* @param qualifierKind1 QualifierKind for {@code a1}
* @param a2 second annotation
* @param qualifierKind2 QualifierKind for {@code a2}
* @param glbKind the kind of the glb of {@code qualifierKind1} and {@code qualifierKind2}
* @return the greatest lower bound between {@code a1} and {@code a2}
*/
protected abstract AnnotationMirror greatestLowerBoundWithElements(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public int numberOfIterationsBeforeWidening() {
* @param newQualifier new qualifier dataflow computed for some expression; must be in the same
* hierarchy as {@code previousQualifier}
* @param previousQualifier the previous qualifier dataflow computed on the last iteration; must
* be in the same hierarchy as {@code previousQualifier}
* be in the same hierarchy as {@code newQualifier}
* @return an upper bound that is higher than the least upper bound of newQualifier and
* previousQualifier (or the lub if the qualifier hierarchy does not require this)
*/
Expand Down Expand Up @@ -582,7 +582,7 @@ public AnnotationMirror widenedUpperBound(
}

/**
* Returns the greatest lower bound of the two sets of qualifiers. The result is the lub of the
* Returns the greatest lower bound of the two sets of qualifiers. The result is the glb of the
* qualifier for the same hierarchy in each set.
*
* @param qualifiers1 a set of qualifiers; exactly one per hierarchy
Expand Down Expand Up @@ -613,7 +613,7 @@ public Set<? extends AnnotationMirror> greatestLowerBoundsQualifiersOnly(
}

/**
* Returns the greatest lower bound of the two sets of qualifiers. The result is the lub of the
* Returns the greatest lower bound of the two sets of qualifiers. The result is the glb of the
* qualifier for the same hierarchy in each set.
*
* @param qualifiers1 a set of qualifiers; exactly one per hierarchy
Expand Down Expand Up @@ -648,8 +648,8 @@ public final Set<? extends AnnotationMirror> greatestLowerBoundsShallow(
}

/**
* Returns the greatest lower bound the all the collections of qualifiers. The result is the glb
* of the qualifier for the same hierarchy in each set.
* Returns the greatest lower bound of all the collections of qualifiers. The result is the glb of
* the qualifier for the same hierarchy in each set.
*
* @param qualifiers a collection of collections of qualifiers. Each inner collection has exactly
* one qualifier per hierarchy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void addTypeKind(TypeKind typeKind, AnnotationMirror theQual) {
boolean res = qualHierarchy.updateMappingToMutableSet(typeKinds, typeKind, theQual);
if (!res) {
throw new BugInCF(
"QualifierUpperBounds: invalid update of typeKinds $s at %s with %s.",
"QualifierUpperBounds: invalid update of typeKinds %s at %s with %s.",
typeKinds, typeKind, theQual);
}
}
Expand All @@ -92,7 +92,7 @@ public void addType(Class<?> type, AnnotationMirror theQual) {
boolean res = qualHierarchy.updateMappingToMutableSet(types, typeNameString, theQual);
if (!res) {
throw new BugInCF(
"QualifierUpperBounds: invalid update of types $s at %s with %s.", types, type, theQual);
"QualifierUpperBounds: invalid update of types %s at %s with %s.", types, type, theQual);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected boolean arePrimaryAnnosEqual(AnnotatedTypeMirror type1, AnnotatedTypeM

/**
* Compare each type in types1 and types2 pairwise and return true if they are all equal. This
* method throws an exceptions if types1.size() != types2.size()
* method throws an exception if types1.size() != types2.size()
*
* @return true if for each pair (t1 = types1.get(i); t2 = types2.get(i)), areEqual(t1,t2)
*/
Expand Down
Loading