From 6cf77c4729845ef821dd88a6fd4515d9b417cf8d Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sun, 28 Jun 2026 21:03:17 -0700 Subject: [PATCH 1/2] Gradle formatting --- annotation-file-utilities/build.gradle | 6 ++-- build.gradle | 20 ++++++------- checker/build.gradle | 40 +++++++++++++------------- dataflow/build.gradle | 8 +++--- framework/build.gradle | 2 +- gradle-mvn-push.gradle | 6 ++-- release.gradle | 6 ++-- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/annotation-file-utilities/build.gradle b/annotation-file-utilities/build.gradle index 11588118a90a..0745f3c6b1ce 100644 --- a/annotation-file-utilities/build.gradle +++ b/annotation-file-utilities/build.gradle @@ -111,9 +111,9 @@ test.dependsOn(testAnnotator) tasks.register("updateUserOptions") { dependsOn( - "updateUserOptionsJavadoc", - "updateUserOptionsHtml" - ) + "updateUserOptionsJavadoc", + "updateUserOptionsHtml" + ) } tasks.register("updateUserOptionsJavadoc", Javadoc) { diff --git a/build.gradle b/build.gradle index 1c81474ad440..946242e0421e 100644 --- a/build.gradle +++ b/build.gradle @@ -98,9 +98,9 @@ tasks.register("installGitHooks", Copy) { } subprojects { subProject -> if (subProject.name.equals("checker") - || subProject.name.equals("annotation-file-utilities") - || subProject.name.equals("dataflow") - || subProject.name.equals("framework")) { + || subProject.name.equals("annotation-file-utilities") + || subProject.name.equals("dataflow") + || subProject.name.equals("framework")) { apply plugin: "com.gradleup.shadow" shadow { addShadowVariantIntoJavaComponent = false @@ -536,13 +536,13 @@ tasks.register("zip", Zip) { from(layout.projectDirectory) { exclude("api/**", - "checker/bin/README", - "checker/dist/*.asc", - "docs/tutorial/tests/**", - "docs/tutorial/src/**", - "docs/tutorial/test/**", - "docs/tutorial/Makefile", - "docs/tutorial/README") + "checker/bin/README", + "checker/dist/*.asc", + "docs/tutorial/tests/**", + "docs/tutorial/src/**", + "docs/tutorial/test/**", + "docs/tutorial/Makefile", + "docs/tutorial/README") include("README.html", "LICENSE.txt", diff --git a/checker/build.gradle b/checker/build.gradle index 701ab24c525b..637f7aae8aba 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -491,10 +491,10 @@ void copyNonannotatedToAnnotatedDirectory(String testdir) { into(file("tests/${testdir}/annotated")) filter { String line -> (line.contains("// :: error:") - // Don't remove unchecked cast warnings, because they're genuinely expected in some all-systems - // tests, such as GenericsCasts.java. - || (line.contains("// :: warning:") && !line.contains("// :: warning: [unchecked]"))) - ? null : line + // Don't remove unchecked cast warnings, because they're genuinely expected in some all-systems + // tests, such as GenericsCasts.java. + || (line.contains("// :: warning:") && !line.contains("// :: warning: [unchecked]"))) + ? null : line } } // The only file for which expected errors are maintained is ExpectedErrors.java, so we copy it over. @@ -950,22 +950,22 @@ tasks.register("wpiManyTest", Exec) { if ( // Ignore the line that WPI echoes with the javac command being run. line.startsWith("Running ") - // Warnings about bad path elements aren't related to WPI and are ignored. - || line.startsWith("warning: [path]") - // Ignore bootstrap classpath warning: - || line.startsWith("warning: [options] bootstrap") - // Ignore the warnings about --add-opens arguments to the JVM - || line.contains("warning: [options] --add-opens has no effect at compile time") - // Ignore warning about using -source; should use --release instead. - || line.equals("warning: [options] system modules path not set in conjunction with -source 11") - // Ignore the summary line that reports the total number of warnings (which can be single or plural). - || line.endsWith(" warning") - || line.endsWith(" warnings") - || line.startsWith("warning: No processor claimed any of these annotations: ") - // Ignore debugging output with the prefix "DEBUG: ". - || line.startsWith("DEBUG: ") - || line.startsWith("warning: DEBUG: ") - || line.contains("warning: [DEBUG: ")) { + // Warnings about bad path elements aren't related to WPI and are ignored. + || line.startsWith("warning: [path]") + // Ignore bootstrap classpath warning: + || line.startsWith("warning: [options] bootstrap") + // Ignore the warnings about --add-opens arguments to the JVM + || line.contains("warning: [options] --add-opens has no effect at compile time") + // Ignore warning about using -source; should use --release instead. + || line.equals("warning: [options] system modules path not set in conjunction with -source 11") + // Ignore the summary line that reports the total number of warnings (which can be single or plural). + || line.endsWith(" warning") + || line.endsWith(" warnings") + || line.startsWith("warning: No processor claimed any of these annotations: ") + // Ignore debugging output with the prefix "DEBUG: ". + || line.startsWith("DEBUG: ") + || line.startsWith("warning: DEBUG: ") + || line.contains("warning: [DEBUG: ")) { return } if (!line.trim().equals("")) { diff --git a/dataflow/build.gradle b/dataflow/build.gradle index 706d7ff2b237..0d1fa0cc998a 100644 --- a/dataflow/build.gradle +++ b/dataflow/build.gradle @@ -221,10 +221,10 @@ final dataflowShadedPom(MavenPublication publication, String shadedPkgName) { // This should just happen automatically, but I can't figure out how to make it happen with // a custom Shadow task. asNode().appendNode("dependencies").appendNode("dependency") - .appendNode("groupId", "org.checkerframework").parent() - .appendNode("artifactId", "checker-qual").parent() - .appendNode("version", version).parent() - .appendNode("scope", "runtime") + .appendNode("groupId", "org.checkerframework").parent() + .appendNode("artifactId", "checker-qual").parent() + .appendNode("version", version).parent() + .appendNode("scope", "runtime") } } } diff --git a/framework/build.gradle b/framework/build.gradle index 662b905a5a86..ad68cbee72c4 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -89,7 +89,7 @@ tasks.register("copyAndMinimizeAnnotatedJdkFiles", JavaExec) { // Populate `annotatedForFiles`. tree.visit { FileVisitDetails fvd -> if (!fvd.file.isDirectory() && fvd.file.name.matches(".*\\.java") - && !fvd.file.path.contains("org/checkerframework")) { + && !fvd.file.path.contains("org/checkerframework")) { fvd.getFile().readLines().any { line -> if (line.contains("@AnnotatedFor") || line.contains("org.checkerframework")) { annotatedForFiles.add(fvd.file.absolutePath) diff --git a/gradle-mvn-push.gradle b/gradle-mvn-push.gradle index dd662a5ab47e..0404fce020d8 100644 --- a/gradle-mvn-push.gradle +++ b/gradle-mvn-push.gradle @@ -7,9 +7,9 @@ publishing { repositories { maven { url = (isSnapshot - ? project.properties.getOrDefault("SNAPSHOT_REPOSITORY_URL", "https://central.sonatype.com/repository/maven-snapshots/") - : project.properties.getOrDefault("RELEASE_REPOSITORY_URL", "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") - ) + ? project.properties.getOrDefault("SNAPSHOT_REPOSITORY_URL", "https://central.sonatype.com/repository/maven-snapshots/") + : project.properties.getOrDefault("RELEASE_REPOSITORY_URL", "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") + ) credentials { username = project.properties.get("SONATYPE_NEXUS_USERNAME") password = project.properties.get("SONATYPE_NEXUS_PASSWORD") diff --git a/release.gradle b/release.gradle index ab0f080849a5..2354b191bc90 100644 --- a/release.gradle +++ b/release.gradle @@ -54,9 +54,9 @@ tasks.register("updateVersionNumbersInDocs", Copy) { from("docs/") { include("annotation-file-utilities/annotation-file-utilities.html", - "checker-framework-quick-start.html", - "checker-framework-webpage.html", - "manual/introduction.tex") + "checker-framework-quick-start.html", + "checker-framework-webpage.html", + "manual/introduction.tex") filter { String line -> line = line.replaceAll("checker-framework-${releaseVersionRegex}", "checker-framework-${releaseVersion}") From d2e2542dcb82cc198bc5c14c445815e6e3a70903 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sun, 28 Jun 2026 21:32:51 -0700 Subject: [PATCH 2/2] Improve message about side effect strength in Lock Checker --- .../checker/lock/LockVisitor.java | 19 ++++++++++++++++++- .../checker/lock/messages.properties | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/checker/src/main/java/org/checkerframework/checker/lock/LockVisitor.java b/checker/src/main/java/org/checkerframework/checker/lock/LockVisitor.java index 60b32f1a515a..84cc005af6be 100644 --- a/checker/src/main/java/org/checkerframework/checker/lock/LockVisitor.java +++ b/checker/src/main/java/org/checkerframework/checker/lock/LockVisitor.java @@ -431,6 +431,8 @@ private void reportFailure( AnnotatedDeclaredType enclosingType, AnnotatedExecutableType overridden, AnnotatedDeclaredType overriddenType, + SideEffectAnnotation seaOfOverriderMethod, + SideEffectAnnotation seaOfOverriddenMethod, List overriderLocks, List overriddenLocks) { // Get the type of the overriding method. @@ -446,14 +448,27 @@ private void reportFailure( if (overriderLocks == null || overriddenLocks == null) { checker.reportError( - overriderTree, messageKey, overriderTyp, overriderMeth, overriddenTyp, overriddenMeth); + overriderTree, + messageKey, + seaOfOverriderMethod, + seaOfOverriddenMethod, + overriderTyp, + seaOfOverriderMethod, + overriderMeth, + overriddenTyp, + seaOfOverriddenMethod, + overriddenMeth); } else { checker.reportError( overriderTree, messageKey, + seaOfOverriderMethod, + seaOfOverriddenMethod, overriderTyp, + seaOfOverriderMethod, overriderMeth, overriddenTyp, + seaOfOverriddenMethod, overriddenMeth, overriderLocks, overriddenLocks); @@ -487,6 +502,8 @@ protected boolean checkOverride( enclosingType, overriddenMethodType, overriddenType, + seaOfOverriderMethod, + seaOfOverriddenMethod, null, null); } diff --git a/checker/src/main/java/org/checkerframework/checker/lock/messages.properties b/checker/src/main/java/org/checkerframework/checker/lock/messages.properties index 132c193e7c69..22c3529b16b1 100644 --- a/checker/src/main/java/org/checkerframework/checker/lock/messages.properties +++ b/checker/src/main/java/org/checkerframework/checker/lock/messages.properties @@ -1,6 +1,6 @@ ### Error messages for the Lock Checker contracts.precondition=call to '%s' requires '%s' to be held -override.sideeffect=the side-effect annotation on an overrider method must be at least as strong as the one the overridden method.%nmethod in %s%n %s%n cannot override method in %s%n %s +override.sideeffect=the overrider annotation %s is weaker than overridden annotation %s.%nmethod in %s%n %s %s%ncannot override method in %s%n %s %s multiple.sideeffect.annotations=method is annotated with multiple side effect annotations multiple.lock.precondition.annotations=only one @Holding, @net.jcip.annotations.GuardedBy or @javax.annotation.concurrent.GuardedBy annotation is allowed on a method multiple.guardedby.annotations=only one @org.checkerframework.checker.lock.qual.GuardedBy, @net.jcip.annotations.GuardedBy or @javax.annotation.concurrent.GuardedBy annotation is allowed on a variable declaration