Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typetools/checker-framework 3.43.0 release #1080

Merged
merged 41 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0418629
typetools/checker-framework 3.43.0 release (#1079)
wmdietl Jan 30, 2025
b3e09b0
Keep Error Prone configuration unchanged
wmdietl Jan 30, 2025
db7ac79
Keep AWS SDK version unchanged
wmdietl Jan 30, 2025
ffc312e
Use EISOP scripts
wmdietl Jan 30, 2025
83f0eb3
Address Error Prone error
wmdietl Jan 30, 2025
0eeef30
Adapt error message keys
wmdietl Feb 1, 2025
ee5fafb
Use EISOP links
wmdietl Feb 1, 2025
5db62b4
Emit correct error key, fix javadoc
wmdietl Feb 1, 2025
1df4bc1
Fix code comment formatting
wmdietl Feb 1, 2025
a894810
Fix changelog entry
wmdietl Feb 1, 2025
05d801c
Fix spotless configuration and downgrade because of crashes
wmdietl Feb 1, 2025
67655e0
Directly get adapted parameter types (#1082)
Ao-senXiong Feb 1, 2025
3b4a602
Undo spurious blank line change
wmdietl Feb 1, 2025
94c0f90
Make a test file an actual .java file
wmdietl Feb 1, 2025
f883b59
Fix typos, code formatting, and comments
wmdietl Feb 3, 2025
90ff585
Tweak tests
wmdietl Feb 3, 2025
380a33a
Fix expected test output
wmdietl Feb 3, 2025
3be36c3
Fix expected output file
wmdietl Feb 3, 2025
8996092
Spotless formatting logic fixes
wmdietl Feb 3, 2025
b173d16
Changelog comment
wmdietl Feb 3, 2025
450c1e8
Javadoc tweaks
wmdietl Feb 3, 2025
4fcc399
Remove unused function. Comment tweaks
wmdietl Feb 3, 2025
7b41a69
Fix error message
wmdietl Feb 3, 2025
3b752a8
Add back work-around to a crash
wmdietl Feb 3, 2025
c297dda
Expand and fix switch test
wmdietl Feb 4, 2025
d975d6f
Remove expected errors that do not happen
wmdietl Feb 4, 2025
1c348b5
Fix expected error location
wmdietl Feb 4, 2025
37b9642
Explain suppression
wmdietl Feb 4, 2025
58148c0
Unskip test that is passing
wmdietl Feb 4, 2025
c7fb005
Suppress invalid location warning in inference result
wmdietl Feb 4, 2025
cee7010
Adapt to type inference failures instead of errors
wmdietl Feb 4, 2025
c1306fe
False positive was fixed
wmdietl Feb 4, 2025
f0036cf
New false positive, at least with some type systems
wmdietl Feb 4, 2025
f29910b
Fix crashes (#1083)
Ao-senXiong Feb 4, 2025
4501f0b
Use eisop/jspecify-reference-checker to decouple the projects
wmdietl Feb 4, 2025
484d788
Stay compatible with Java 8
wmdietl Feb 4, 2025
9d64e47
Add some missing javadoc, skip the rest
wmdietl Feb 4, 2025
5d0c818
Suppress warnings instead of skipping the test
wmdietl Feb 4, 2025
2cbf59f
Output the number of files checked
wmdietl Feb 5, 2025
897ae57
Do not perform unnecessary check
wmdietl Feb 5, 2025
9c9bad0
Skip test with `var` below JDK 10
wmdietl Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
{
"matchPackageNames": ["com.amazonaws:aws-java-sdk-bom"],
"schedule": ["before 3am on the first day of the month"]
},
{
"description": "We want specifically version 3.3.2, which caused a crash before",
"matchPackageNames": ["org.apache.spark:spark-sql_2.12"],
"enabled": false
}
]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ tags
*.swp
*.orig
.DS_Store
dot_files

# Eclipse files
.metadata
.classpath
.project
.externalToolBuilders
.settings
dot_files
**/*.factorypath

# Intellij files
.idea
Expand Down
Empty file added SKIP-REQUIRE-JAVADOC
Empty file.
199 changes: 128 additions & 71 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
// Code formatting; defines targets "spotlessApply" and "spotlessCheck".
// https://github.com/diffplug/spotless/tags ; see tags starting "gradle/"
// Only works on JDK 11+.
classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.0.2'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.0.1'
}
}
}
Expand Down Expand Up @@ -42,7 +42,9 @@ def majorVersionToInt(majorVersionString) {
}

ext {
release = false
// Whether to use EISOP formatting.
// Can also be achieved by having a project property with the same name.
eisopFormatting = true

// On a Java 8 JVM, use error-prone javac and source/target 8.
// On a Java 9+ JVM, use the host javac, default source/target, and required module flags.
Expand Down Expand Up @@ -76,11 +78,12 @@ ext {
versions = [
autoValue : '1.11.0',
errorprone : '2.36.0',
googleJavaFormat : '1.25.2',
hashmapUtil : '0.0.1',
junit : '4.13.2',
lombok : '1.18.36',
// plume-util includes a version of reflection-util. When updating ensure the versions are consistent.
plumeUtil : '1.9.0',
plumeUtil : '1.9.3',
reflectionUtil : '1.1.3',
]
}
Expand Down Expand Up @@ -145,21 +148,21 @@ if (currentRuntimeJavaVersion >= 11) {
// > Could not create task ':spotlessJava'.
// > Add a step with [com.google.googlejavaformat:google-java-format:1.15.0] into the `spotlessPredeclare` block in the root project.
java {
googleJavaFormat()
googleJavaFormat(versions.googleJavaFormat)
}
groovyGradle {
greclipse()
}
}
}

allprojects {
allprojects { currentProj ->
// Increment the minor version (second number) rather than just the patch
// level (third number) if:
// * any new checkers have been added, or
// * backward-incompatible changes have been made to APIs or elsewhere.
// To make a snapshot release: ./gradlew publish
version = '3.42.0-eisop6-SNAPSHOT'
version = '3.43.0'

tasks.withType(JavaCompile).configureEach {
options.fork = true
Expand Down Expand Up @@ -245,31 +248,48 @@ allprojects {

if (currentRuntimeJavaVersion >= 11) {
apply plugin: 'com.diffplug.spotless'
// patterns of files to skip for individual sub-projects
def perProjectDoNotFormat = [
'checker': [
'bin-devel/.git-scripts/**',
'bin-devel/.plume-scripts/**',
'dist/**',
'tests/ainfer-*/annotated/*',
'tests/build/**',
'tests/calledmethods-delomboked/*',
'tests/nullness-javac-errors/*',
],
'dataflow': ['manual/examples/'],
'framework': [
'tests/build/**',
'tests/returnsreceiverdelomboked/*',
],
]
spotless {
// If you add any formatters to this block that require dependencies, then you must also
// add them to spotlessPredeclare block.

// Always skip formatting of files under build directory
def doNotFormat = [
'checker/bin-devel/.git-scripts/**',
'checker/bin-devel/.plume-scripts/**',
'checker/tests/ainfer-*/annotated/*',
'dataflow/manual/examples/',
'**/nullness-javac-errors/*',
'**/calledmethods-delomboked/*',
'**/returnsreceiverdelomboked/*',
'**/build/**',
'*/dist/**',
'build/**',
'examples/lombok/build/**'
]
if (currentRuntimeJavaVersion < 14) {
doNotFormat += ['**/*record*/']
}
if (currentRuntimeJavaVersion < 16) {
// TODO: directories should be renamed `-switchexpr` or some such,
// as they only contain examples for switch expressions, which were
// added in Java 14, not Java 17.
doNotFormat += ['**/java17/']
}
if (currentRuntimeJavaVersion < 21) {
doNotFormat += ['**/java21/']
if (currentProj != project.rootProject) {
if (perProjectDoNotFormat.containsKey(currentProj.name)) {
doNotFormat += perProjectDoNotFormat[currentProj.name]
}
if (currentRuntimeJavaVersion < 14) {
doNotFormat += ['**/*record*/']
}
if (currentRuntimeJavaVersion < 16) {
// TODO: directories should be renamed `-switchexpr` or some such,
// as they only contain examples for switch expressions, which were
// added in Java 14, not Java 17.
doNotFormat += ['**/java17/']
}
if (currentRuntimeJavaVersion < 21) {
doNotFormat += ['tests/**/java21/']
}
}

format 'misc', {
Expand All @@ -283,40 +303,64 @@ allprojects {
}

java {
def targets = [
// add target folders here
'checker',
'checker-qual',
'checker-util',
'dataflow',
'docs/examples',
'docs/tutorial',
'framework',
'framework-test',
'javacutil',
]
targets = targets.collectMany {
[
// must call toString() to convert GString to String
"${it}/**/*.java".toString(),
"${it}/**/*.ajava".toString()
if (currentProj == currentProj.rootProject) {
// format .java files outside of Gradle sub-projects
def targets = [
'docs/examples',
'docs/tutorial',
]
targets = targets.collectMany {
[
// must call toString() to convert GString to String
"${it}/**/*.java".toString(),
// Not .ajava files because formatting would remove import statements.
]
}
target targets
} else {
// not the root project; format all .java files in the sub-project
target '**/*.java', '**/*.ajava'
}
target targets
targetExclude doNotFormat

googleJavaFormat().aosp()
importOrder('com', 'jdk', 'lib', 'lombok', 'org', 'java', 'javax')
if (eisopFormatting || project.hasProperty('eisopFormatting')) {
googleJavaFormat(versions.googleJavaFormat).aosp()
importOrder('com', 'jdk', 'lib', 'lombok', 'org', 'java', 'javax')
} else {
googleJavaFormat(versions.googleJavaFormat) // the formatter to apply to Java files
}
formatAnnotations().addTypeAnnotation("PolyInitialized").addTypeAnnotation("PolyVP").addTypeAnnotation("ReceiverDependentQual")
}

groovyGradle {
target '**/*.gradle'
targetExclude doNotFormat
greclipse() // which formatter Spotless should use to format .gradle files.
leadingTabsToSpaces(4)
trimTrailingWhitespace()
// endWithNewline() // Don't want to end empty files with a newline
// Only define a groovyGradle task on the root project, for simplicity in setting the target pattern
if (currentProj == currentProj.rootProject) {
groovyGradle {
target '**/*.gradle'
targetExclude doNotFormat
greclipse() // which formatter Spotless should use to format .gradle files.
if (eisopFormatting || project.hasProperty('eisopFormatting')) {
leadingTabsToSpaces(4)
} else {
leadingTabsToSpaces(2)
}
trimTrailingWhitespace()
// endWithNewline() // Don't want to end empty files with a newline
}
}

// a useful task for debugging; prints exactly which files are getting formatted by spotless
tasks.register('printSpotlessTaskInputs') {
doLast {
project.tasks.forEach { task ->
if (task.name.contains('spotless')) {
println "Inputs for task '${task.name}':"

task.inputs.files.each { inputFile ->
println " Input: $inputFile"
}
}
}
}
}
}
}
Expand Down Expand Up @@ -510,8 +554,6 @@ allprojects {
options.errorprone.errorproneArgs = [
// Many compiler classes are interned.
'-Xep:ReferenceEquality:OFF',
// These might be worth fixing.
'-Xep:DefaultCharset:OFF',
// Not useful to suggest Splitter; maybe clean up.
'-Xep:StringSplitter:OFF',
// Too broad, rejects seemingly-correct code.
Expand Down Expand Up @@ -676,9 +718,14 @@ task allJavadoc(type: Javadoc, group: 'Documentation') {
}

classpath = configurations.allProjects

if (isJava8) {
classpath += configurations.javacJar
}

// disable interpreting module-info.java files until all sub-modules support them
modularity.inferModulePath = false

doLast {
copy {
from 'docs/logo/Checkmark/CFCheckmark_favicon.png'
Expand Down Expand Up @@ -736,6 +783,8 @@ def createJavadocTask(taskName, taskDescription, memberLevel) {
}

classpath = configurations.allProjects
// disable interpreting module-info.java files until all sub-modules support them
modularity.inferModulePath = false

destinationDir.deleteDir()
options.memberLevel = memberLevel
Expand Down Expand Up @@ -931,6 +980,7 @@ subprojects {
// For an example work-around see NullnessAnnotatedTypeFactory#NONNULL_ALIASES.

// Relocate packages that might conflict with user's classpath.
relocate 'com.github.javaparser', 'org.checkerframework.com.github.javaparser'
relocate 'org.apache', 'org.checkerframework.org.apache'
relocate 'org.relaxng', 'org.checkerframework.org.relaxng'
relocate 'org.plumelib', 'org.checkerframework.org.plumelib'
Expand All @@ -944,13 +994,6 @@ subprojects {

exclude '**/module-info.class'

doFirst {
if (release) {
// Only relocate JavaParser during a release:
relocate 'com.github.javaparser', 'org.checkerframework.com.github.javaparser'
}
}

minimize()
}

Expand Down Expand Up @@ -984,7 +1027,7 @@ subprojects {
manifest {
attributes('Implementation-Version': "${project.version}")
attributes('Implementation-URL': 'https://eisop.github.io/')
if (! archiveFileName.get().endsWith('source.jar')) {
if (! archiveFileName.get().endsWith('source.jar') && ! archiveFileName.get().startsWith('checker-qual')) {
attributes('Automatic-Module-Name': 'org.checkerframework.' + project.name.replaceAll('-', '.'))
}
if (archiveFileName.get().startsWith('checker-qual') || archiveFileName.get().startsWith('checker-util')) {
Expand Down Expand Up @@ -1150,7 +1193,25 @@ subprojects {
jvmArgs += compilerArgsForRunningCF
}

maxParallelForks = Integer.MAX_VALUE
// Run tests in parallel, except on CI where it seems to lead to flaky failures.
// The TF_BUILD environment variable is set to 'True' for jobs running on Azure Pipelines.
if (!System.getenv('TF_BUILD')?.equals('True')) {
// Not running under Azure Pipelines CI.

// This uses Gradle's recommended value for `maxParallelForks`:
// https://docs.gradle.org/current/userguide/performance.html#optimize_java_projects
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
} else {
// Running under Azure Pipelines CI.

// Azure seems to time out when a task doesn't produce periodic output.
if (project.name.is('checker')) {
testLogging {
events "started", "skipped", "failed"
displayGranularity 3
}
}
}

if (project.name.is('checker')) {
dependsOn('assembleForJavac')
Expand Down Expand Up @@ -1290,17 +1351,13 @@ task buildAll(group: 'Build') {
dependsOn("${subproject.name}:sourcesJar")
}
dependsOn('framework:allJavadocJar', 'framework:allSourcesJar', 'checker:allJavadocJar', 'checker:allSourcesJar', 'checker-qual:jar', 'checker-util:jar')
dependsOn('checker:assembleForJavac')
}

task releaseBuild(group: 'Build') {
description = 'Build everything required for a release'
description = 'Cleans, then builds everything required for a release'
dependsOn(clean)
doFirst {
release = true
}
// Use finalizedBy rather than dependsOn so that release is set to true before any of the tasks are run.
finalizedBy(buildAll)
finalizedBy('checker:assembleForJavac')
dependsOn(buildAll)
}

// No group so it does not show up in the output of `gradlew tasks`
Expand Down
30 changes: 30 additions & 0 deletions checker-qual/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ if (JavaVersion.current() >= JavaVersion.VERSION_17) {
apply plugin: 'biz.aQute.bnd.builder'
}

sourceSets {
main {
java {
exclude 'module-info.java'
}
}
module_info {
java {
srcDirs ('src/main')
}
}
}

task compileJava9(type: JavaCompile) {
source = sourceSets.module_info.java
destinationDirectory = sourceSets.main.output.classesDirs[0]
classpath = configurations.allProjects
options.release = 9
}

compileJava {
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
dependsOn compileJava9
}
}

javadoc {
modularity.inferModulePath = false
}

jar {
manifest {
attributes('Export-Package': '*')
Expand Down
Loading
Loading