Skip to content

Commit 5cc3a3a

Browse files
Code review
Co-authored-by: Michael Ernst <mernst@cs.washington.edu>
1 parent bc5f09e commit 5cc3a3a

29 files changed

Lines changed: 93 additions & 90 deletions

framework/src/main/java/org/checkerframework/common/value/ValueCheckerUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public static List<Integer> getLengthsForStringValues(List<String> values) {
371371

372372
/**
373373
* Finds the maximum value in a Value Checker type. If there is no information (such as when the
374-
* list of possible values is empty or null), returns null. Otherwise, returns the smallest value
374+
* list of possible values is empty or null), returns null. Otherwise, returns the largest value
375375
* in the list of possible values.
376376
*/
377377
public static @Nullable Long getMaxValue(Tree tree, ValueAnnotatedTypeFactory factory) {

framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ public AnnotatedTypeFactory(BaseTypeChecker checker) {
726726
* That is, no element has a {@code @Target} meta-annotation that contains something besides
727727
* TYPE_USE or TYPE_PARAMETER. ({@code @Target({})} is allowed.)
728728
*
729-
* @throws BugInCF If supportedQuals is empty or contaions a non-type qualifier
729+
* @throws TypeSystemError if supportedQuals is empty or contains a non-type qualifier
730730
*/
731731
private void checkSupportedQualsAreTypeQuals() {
732732
if (supportedQuals == null || supportedQuals.isEmpty()) {
@@ -1893,7 +1893,7 @@ public void postAsMemberOf(AnnotatedTypeMirror type, AnnotatedTypeMirror owner,
18931893
*
18941894
* @param type annotated type to which the annotation is added
18951895
* @param accessedVia the annotated type of the receiver of the accessing tree. (Only used to get
1896-
* the type element of the underling type.)
1896+
* the type element of the underlying type.)
18971897
* @param field element representing the field
18981898
*/
18991899
protected void addAnnotationFromFieldInvariant(
@@ -2652,11 +2652,11 @@ protected void adaptGetClassReturnTypeToReceiver(
26522652

26532653
/**
26542654
* Returns the element type of {@code expression}. This is usually the type of {@code
2655-
* expression.itertor().next()}. If {@code expression} is an array, it is the component type of
2655+
* expression.iterator().next()}. If {@code expression} is an array, it is the component type of
26562656
* the array.
26572657
*
26582658
* @param expression an expression whose type is an array or implements {@link Iterable}
2659-
* @return the type of {@code expression.itertor().next()} or if {@code expression} is an array,
2659+
* @return the type of {@code expression.iterator().next()} or if {@code expression} is an array,
26602660
* the component type of the array
26612661
*/
26622662
public AnnotatedTypeMirror getIterableElementType(ExpressionTree expression) {
@@ -2665,12 +2665,12 @@ public AnnotatedTypeMirror getIterableElementType(ExpressionTree expression) {
26652665

26662666
/**
26672667
* Returns the element type of {@code iterableType}. This is usually the type of {@code
2668-
* expression.itertor().next()}. If {@code expression} is an array, it is the component type of
2668+
* expression.iterator().next()}. If {@code expression} is an array, it is the component type of
26692669
* the array.
26702670
*
26712671
* @param expression an expression whose type is an array or implements {@link Iterable}
26722672
* @param iterableType the type of the expression
2673-
* @return the type of {@code expression.itertor().next()} or if {@code expression} is an array,
2673+
* @return the type of {@code expression.iterator().next()} or if {@code expression} is an array,
26742674
* the component type of the array
26752675
*/
26762676
protected AnnotatedTypeMirror getIterableElementType(
@@ -4007,7 +4007,7 @@ public boolean shouldWarnIfStubRedundantWithBytecode() {
40074007
*
40084008
* @param elt the element to retrieve the annotation from
40094009
* @param annoClass the class of the annotation to retrieve
4010-
* @param checkAliases if true, the metnhod may return an annotation mirror for an alias of the
4010+
* @param checkAliases if true, the method may return an annotation mirror for an alias of the
40114011
* requested annotation class name
40124012
* @return the annotation mirror for the requested annotation, or null if not found
40134013
*/
@@ -4767,7 +4767,7 @@ private AnnotatedTypeMirror getFunctionalInterfaceType(Tree tree) {
47674767
*
47684768
* @param typeMirror a type that must be a functional interface
47694769
* @param contextTree the tree that has the given type; used only for diagnostic messages
4770-
* @param tree a labmba tree that encloses {@code contextTree}; used only for diagnostic messages
4770+
* @param tree a lambda tree that encloses {@code contextTree}; used only for diagnostic messages
47714771
*/
47724772
private void assertIsFunctionalInterface(TypeMirror typeMirror, Tree contextTree, Tree tree) {
47734773
if (typeMirror.getKind() == TypeKind.WILDCARD) {
@@ -5787,7 +5787,7 @@ public boolean doesAnnotatedForApplyToThisChecker(AnnotationMirror annotatedForA
57875787
* Returns the {@code expression} field/element of the given contract annotation.
57885788
*
57895789
* @param contractAnno a {@link RequiresQualifier}, {@link EnsuresQualifier}, or {@link
5790-
* EnsuresQualifier}
5790+
* EnsuresQualifierIf}
57915791
* @return the {@code expression} field/element of the given annotation
57925792
*/
57935793
public List<String> getContractExpressions(AnnotationMirror contractAnno) {

framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeMirror.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public boolean hasPrimaryAnnotationInHierarchy(AnnotationMirror annotation) {
252252
* #getAnnotationInHierarchy(AnnotationMirror)} should be called instead.
253253
*
254254
* @param annotation an annotation in the qualifier hierarchy to check for
255-
* @return the annotation mirror whose class is named {@code annoNAme} or null
255+
* @return the annotation in the same hierarchy as {@code annotation}, or null
256256
*/
257257
public @Nullable AnnotationMirror getPrimaryAnnotationInHierarchy(AnnotationMirror annotation) {
258258
if (primaryAnnotations.isEmpty()) {
@@ -377,7 +377,7 @@ public AnnotationMirrorSet getAnnotations() {
377377
* <p>This method requires that there is only a single hierarchy. Therefore, it is equivalent to
378378
* {@link #getAnnotationInHierarchy(AnnotationMirror)}.
379379
*
380-
* @return a set of the annotations on this
380+
* @return the annotation on this type, or null if there is none
381381
*/
382382
public final AnnotationMirror getAnnotation() {
383383
AnnotationMirrorSet effectiveAnnotations = getAnnotations();
@@ -386,7 +386,7 @@ public final AnnotationMirror getAnnotation() {
386386
return null;
387387
}
388388
if (effectiveAnnotations.size() != 1) {
389-
throw new BugInCF("Bad annotation size for getPrimaryAnnotation(): " + this);
389+
throw new BugInCF("Bad annotation size for getAnnotation(): " + this);
390390
}
391391
return effectiveAnnotations.iterator().next();
392392
}
@@ -669,7 +669,7 @@ public void addAnnotations(Iterable<? extends AnnotationMirror> annotations) {
669669
* {@link AnnotatedIntersectionType}s, adds them to all bounds. (The canonical version is found
670670
* via {@link AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror)} or {@link
671671
* AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror,TypeMirror)}.) If the canonical
672-
* version of an annotation is not a supported qualifier, then that annotation is not add added.
672+
* version of an annotation is not a supported qualifier, then that annotation is not added.
673673
*
674674
* @param annotations the annotations to add
675675
*/
@@ -688,7 +688,7 @@ public void addMissingAnnotations(Iterable<? extends AnnotationMirror> annotatio
688688
* {@link AnnotatedIntersectionType}s) added to all bounds. (The canonical version is found via
689689
* {@link AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror)} or {@link
690690
* AnnotatedTypeFactory#canonicalAnnotation(AnnotationMirror,TypeMirror)}.) If the canonical
691-
* version of an {@code annotation} is not a supported qualifier, then that annotation is not add
691+
* version of an {@code annotation} is not a supported qualifier, then that annotation is not
692692
* added.
693693
*
694694
* @param annotation the annotations to add
@@ -1741,9 +1741,9 @@ public TypeVariable getUnderlyingType() {
17411741
/**
17421742
* Set the lower bound of this variable type.
17431743
*
1744-
* <p>Returns the lower bound of this type variable. While a type parameter cannot include an
1745-
* explicit lower bound declaration, capture conversion can produce a type variable with a
1746-
* non-trivial lower bound. Type variables otherwise have a lower bound of NullType.
1744+
* <p>While a type parameter cannot include an explicit lower bound declaration, capture
1745+
* conversion can produce a type variable with a non-trivial lower bound. Type variables
1746+
* otherwise have a lower bound of NullType.
17471747
*
17481748
* @param type the lower bound type
17491749
*/

framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeParameterBounds.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public boolean equals(@Nullable Object obj) {
4646
if (!(obj instanceof AnnotatedTypeParameterBounds other)) {
4747
return false;
4848
}
49-
return this.upper == null
50-
? other.upper == null
51-
: (this.upper.equals(other.upper) && this.lower == null)
52-
? other.lower == null
53-
: this.lower.equals(other.lower);
49+
return Objects.equals(this.upper, other.upper) && Objects.equals(this.lower, other.lower);
5450
}
5551
}

framework/src/main/java/org/checkerframework/framework/type/AsSuperVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private AnnotatedTypeMirror copyPrimaryAnnos(AnnotatedTypeMirror from, Annotated
172172
* A helper method for asSuper(AMT, Wildcard) methods to use to annotate the wildcard's lower
173173
* bound.
174174
*
175-
* <p>If the lower bound of superType is Null, then return copyPrimarayAnnos(type, superType)
175+
* <p>If the lower bound of superType is Null, then return copyPrimaryAnnos(type, superType)
176176
*
177177
* <p>otherwise, return asSuper(type, superType.getLowerBound()
178178
*

framework/src/main/java/org/checkerframework/framework/type/BoundsInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ private void initializeTypeVariable(AnnotatedTypeVariable annotatedTypeVariable)
162162
/**
163163
* Sets the extends and super bounds of {@code annotatedWildcardType} to {@code
164164
* AnnotatedTypeMirror} that match the upper and lower bounds of the underlying type of {@code
165-
* annotatedWildcardType} by calling visiting each bound. This method should only be called once
166-
* per {@link WildcardType}.
165+
* annotatedWildcardType} by visiting each bound. This method should only be called once per
166+
* {@link WildcardType}.
167167
*
168168
* @param annotatedWildcardType an annotated wildcard type
169169
*/

framework/src/main/java/org/checkerframework/framework/type/DeclarationsIntoElements.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ private DeclarationsIntoElements() {
3232
/**
3333
* The entry point.
3434
*
35+
* @param env the processing environment
3536
* @param atypeFactory the type factory
3637
* @param tree the ClassTree to process
3738
*/

framework/src/main/java/org/checkerframework/framework/type/DefaultAnnotatedTypeFormatter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected static class FormattingVisitor
139139
/**
140140
* For a given call to format, this setting specifies whether or not to printInvisibles. If a
141141
* user did not specify a printInvisible parameter in the call to format then this value will
142-
* equal DefaultAnnotatedTypeFormatter.defaultInvisibleSettings for this object
142+
* equal DefaultAnnotatedTypeFormatter.defaultInvisiblesSetting for this object
143143
*/
144144
protected boolean currentPrintInvisibleSetting;
145145

@@ -148,7 +148,7 @@ protected static class FormattingVisitor
148148

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

framework/src/main/java/org/checkerframework/framework/type/DefaultTypeHierarchy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ public Boolean visitWildcard_Wildcard(
11291129
*
11301130
* @param subtype the possible subtype
11311131
* @param supertype the possible supertype
1132-
* @return true {@code subtype} is a subtype of {@code supertype}
1132+
* @return true if {@code subtype} is a subtype of {@code supertype}
11331133
*/
11341134
protected boolean visitType_Intersection(
11351135
AnnotatedTypeMirror subtype, AnnotatedIntersectionType supertype) {

framework/src/main/java/org/checkerframework/framework/type/ElementAnnotationApplier.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ public static void apply(
9292
}
9393
}
9494

95-
/** Issues an "invalid.annotation.location.bytecode warning. */
95+
/**
96+
* Issues an "invalid.annotation.location.bytecode" warning.
97+
*
98+
* @param element the location at which to report the warning
99+
* @param typeFactory the factory that reports the warning
100+
*/
96101
private static void reportInvalidLocation(Element element, AnnotatedTypeFactory typeFactory) {
97102
Element report = element;
98103
if (element.getEnclosingElement().getKind() == ElementKind.METHOD) {
@@ -183,6 +188,7 @@ public static void annotateSupers(
183188
* has been placed here.
184189
*
185190
* @param varEle the element that may represent a lambda's parameter
191+
* @param typeFactory the type factory
186192
* @return a LambdaExpressionTree if the varEle represents a parameter in a lambda expression,
187193
* otherwise null
188194
*/

0 commit comments

Comments
 (0)