Skip to content

Commit

Permalink
Punctuation changes (#5689)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Mar 2, 2023
1 parent 9a0d70b commit a509138
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 32 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ allprojects {
apply plugin: 'net.ltgt.errorprone'

group 'org.checkerframework'

// Increment the minor version (second number) rather than just the patch
// level (third number) if:
// * any new checkers have been added, or
Expand Down Expand Up @@ -206,7 +207,6 @@ allprojects {
format 'misc', {
// define the files to apply `misc` to
target '**/*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
indentWithSpaces(2)
trimTrailingWhitespace()
Expand Down Expand Up @@ -259,7 +259,6 @@ allprojects {
trimTrailingWhitespace()
// endWithNewline() // Don't want to end empty files with a newline
}

}
}

Expand Down Expand Up @@ -1211,7 +1210,7 @@ jar.onlyIf {false}
*/
final sharedPublicationConfiguration(publication) {
publication.pom {
url = 'https://checkerframework.org'
url = 'https://checkerframework.org/'
developers {
// These are the lead developers/maintainers, not all the developers or contributors.
developer {
Expand Down
2 changes: 1 addition & 1 deletion checker/bin-devel/test-plume-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "SHELLOPTS=${SHELLOPTS}"
# Optional argument $1 is the group.
GROUPARG=$1
echo "GROUPARG=$GROUPARG"
# These are all the Java projects at https://github.com/plume-lib , as of Dec 2022.
# These are all the Java projects at https://github.com/plume-lib as of Dec 2022.
if [[ "${GROUPARG}" == "bcel-util" ]]; then PACKAGES=("${GROUPARG}"); fi
if [[ "${GROUPARG}" == "bibtex-clean" ]]; then PACKAGES=("${GROUPARG}"); fi
if [[ "${GROUPARG}" == "html-pretty-print" ]]; then PACKAGES=("${GROUPARG}"); fi
Expand Down
7 changes: 4 additions & 3 deletions checker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
// https://github.com/n0mer/gradle-git-properties ; target is: generateGitProperties
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
}

sourceSets {
main {
resources {
Expand All @@ -14,7 +15,6 @@ sourceSets {
testannotations
}


sourcesJar {
// The resources duplicate content from the src directory.
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Expand Down Expand Up @@ -186,6 +186,7 @@ shadowJar {
description 'Creates checker-VERSION-all.jar and copies it to dist/checker.jar.'
// To see what files are incorporated into the shadow jar file:
// doFirst { println sourceSets.main.runtimeClasspath.asPath }

doLast{
copy {
from archiveFile.get()
Expand Down Expand Up @@ -348,8 +349,6 @@ task jtregJdk11Tests(group: 'Verification') {
'.'
]
}


}
}

Expand Down Expand Up @@ -1064,6 +1063,7 @@ final checkerPom(publication) {
}
}
}

publishing {
publications {
checker(MavenPublication) {
Expand All @@ -1075,6 +1075,7 @@ publishing {
}
}
}

signing {
sign publishing.publications.checker
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.checkerframework.javacutil.TreeUtils;

/**
* This visitor implements the custom error message finalizer.invocation. It also supports counting
* the number of framework build calls.
* This visitor implements the custom error message "finalizer.invocation". It also supports
* counting the number of framework build calls.
*/
public class CalledMethodsVisitor extends AccumulationVisitor {

Expand Down Expand Up @@ -78,7 +78,7 @@ public Void visitMethodInvocation(MethodInvocationTree tree, Void p) {
return super.visitMethodInvocation(tree, p);
}

/** Turns some method.invocation errors into finalizer.invocation errors. */
/** Turns some "method.invocation" errors into "finalizer.invocation" errors. */
@Override
protected void reportMethodInvocabilityError(
MethodInvocationTree tree, AnnotatedTypeMirror found, AnnotatedTypeMirror expected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,14 @@ protected void commonAssignmentCheck(
valueTree, "i18nformat.missing.arguments", varType.toString(), valueType.toString());
} else if (rhsArgTypes.length > lhsArgTypes.length) {
// Since it is known that too many conversion categories were provided, issue a more
// specific error message to that effect than assignment.
// specific error message to that effect than "assignment".
checker.reportError(
valueTree, "i18nformat.excess.arguments", varType.toString(), valueType.toString());
}
}

// By calling super.commonAssignmentCheck last, any i18nformat.excess.arguments message
// issued for a given line of code will take precedence over the
// assignment
// By calling super.commonAssignmentCheck last, any "i18nformat.excess.arguments"
// message issued for a given line of code will take precedence over the "assignment"
// issued by super.commonAssignmentCheck.
super.commonAssignmentCheck(varType, valueType, valueTree, errorKey, extraArgs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected DependentTypesHelper createDependentTypesHelper() {
@Override
protected void reportErrors(Tree errorTree, List<DependentTypesError> errors) {
// If the error message is NOT_EFFECTIVELY_FINAL, then report
// lock.expression.not.final instead of expression.unparsable .
// "lock.expression.not.final" instead of "expression.unparsable".
List<DependentTypesError> superErrors = new ArrayList<>(errors.size());
for (DependentTypesError error : errors) {
if (error.error.equals(NOT_EFFECTIVELY_FINAL)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ private TreePath getPathForLocalVariableRetrieval(TreePath path) {
// TODO: handle annotations in trees of kind NEW_CLASS (and add test coverage for this
// scenario).
// Currently an annotation in such a tree, such as "new @GuardedBy("foo") Object()",
// results in a constructor.invocation error. This must be fixed first.
// results in a "constructor.invocation" error. This must be fixed first.

path = path.getParentPath();

Expand Down Expand Up @@ -1092,8 +1092,8 @@ public Void visitCompoundAssignment(CompoundAssignmentTree tree, Void p) {
*/
// TODO: If and when the de-sugared .toString() tree is accessible from BaseTypeVisitor,
// the toString() method call should be visited instead of doing this. This would result
// in contracts.precondition errors being issued instead of
// contracts.precondition.field, so it would be clear that
// in "contracts.precondition" errors being issued instead of
// "contracts.precondition.field", so it would be clear that
// the error refers to an implicit method call, not a dereference (field access).
private void checkPreconditionsForImplicitToStringCall(ExpressionTree tree) {
AnnotationMirror gbAnno =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public Void visitTypeCast(TypeCastTree tree, AnnotatedTypeMirror type) {
AnnotationMirror NONNULL = ((NullnessAnnotatedTypeFactory) atypeFactory).NONNULL;
// If a @Nullable expression is cast to a primitive, then an unboxing.of.nullable
// error is issued. Treat the cast as if it were annotated as @NonNull to avoid an
// annotations.on.use error.
// "annotations.on.use" error.
if (!type.isAnnotatedInHierarchy(NONNULL)) {
type.addAnnotation(NONNULL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1799,16 +1799,18 @@ private void propagateObligationsToSuccessorBlocks(
// immediately issued, because such a parameter should not go out of scope
// without its obligation being resolved some other way.
if (obligation.derivedFromMustCallAlias()) {
// MustCallAlias annotations only have meaning if the method returns normally,
// so issue an error if and only if this exit is happening on a normal exit path.
// MustCallAlias annotations only have meaning if the method returns
// normally, so issue an error if and only if this exit is happening on a
// normal exit path.
if (exceptionType == null) {
checker.reportError(
obligation.resourceAliases.asList().get(0).tree,
"mustcallalias.out.of.scope",
exitReasonForErrorMessage);
}
// Whether or not an error is issued, the check is now complete - there is no further
// checking to do on a must-call-alias-derived obligation along an exceptional path.
// Whether or not an error is issued, the check is now complete - there is
// no further checking to do on a must-call-alias-derived obligation along
// an exceptional path.
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ protected AnnotationMirror combine(
} else
// The two annotations are incomparable
// TODO: Issue a warning at the proper code location.
// TODO: Returning bottom leads to obscure error messages. It would probably be better
// to issue a warning in this method, then return lub as usual.
// TODO: Returning bottom leads to obscure error messages. It would probably be
// better to issue a warning in this method, then return lub as usual.
return SIGNEDNESS_BOTTOM;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private boolean isUnitsMultiple(AnnotationMirror metaAnno) {
}

/** A class loader for looking up annotations. */
private static final ClassLoader classLoader =
private static final ClassLoader CLASSLOADER =
InternalUtils.getClassLoaderForClass(AnnotationUtils.class);

/**
Expand All @@ -361,7 +361,7 @@ private void addUnitsRelations(Class<? extends Annotation> qual) {
}
Class<?> valueElement;
try {
valueElement = Class.forName(theclassname, true, classLoader);
valueElement = Class.forName(theclassname, true, CLASSLOADER);
} catch (ClassNotFoundException e) {
String msg =
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static class Inner {}
@AinferTreatAsSibling1 public Outer.Inner preAnnotated = null;

public static void test(InnerClassFieldDeclAnno a) {
// :: warning: assignment
// :: warning: (assignment)
@AinferSibling1 Object obj = a.iShouldBeTreatedAsSibling1;
// Test that the annotation works as expected.
@AinferSibling1 Object obj2 = a.preAnnotated;
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/lock/ChapterExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ void boxingUnboxing() {
@GuardedBy({}) int d;
synchronized(lock) {
// TODO re-enable this error (assignment)
d = b; // TODO: This should not result in assignment because 'b' is actually syntactic sugar for b.intValue().
d = b; // TODO: This should not result in "assignment" because 'b' is actually syntactic sugar for b.intValue().
d = b.intValue(); // The de-sugared version does not issue an error.
}
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/lock/TestConcurrentSemantics2.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void method() {
// * Context switch to a different thread.
// * bar() is called on the other thread.
// * Context switch back to this thread.
// o is no longer null and an assignment error should be issued.
// o is no longer null and an "assignment" error should be issued.
// :: error: (assignment)
@GuardedBy("b") Object o2 = o;
}
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/lock/TestTreeKinds.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ enum myEnumType {
@GuardedBy("lock") myEnumType myEnum;

void testEnumType() {
// TODO: assignment is technically correct, but we could
// TODO: "assignment" is technically correct, but we could
// make it friendlier for the user if constant enum values on the RHS
// automatically cast to the @GuardedBy annotation of the LHS.
// :: error: (assignment)
Expand Down
2 changes: 1 addition & 1 deletion framework/tests/all-systems/InferTypeArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/**
* This test came from running the compilermsgs checker in the checker-framework/checker directory
* It's to test the result of type argument inference. We used to have the following return found:
* It's to test the result of type argument inference. We used to have the following "return" found:
* FlowAnalysis[ extends @UnknownPropertyKey CFAbstractAnalysis<Value[ extends @UnknownPropertyKey
* CFAbstractValue<Value[ extends @UnknownPropertyKey CFAbstractValue<Value>
* super @UnknownPropertyKey Void]> super @UnknownPropertyKey Void], Store[
Expand Down

0 comments on commit a509138

Please sign in to comment.