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.39.0 release #603

Merged
merged 27 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f8b3aa0
typetools/checker-framework 3.39.0 release (#602)
wmdietl Oct 18, 2023
db33f51
Update docker images and deploy them
wmdietl Oct 19, 2023
fb45bb8
Update CI configuration
wmdietl Oct 19, 2023
61c9bbb
Build config tweaks
wmdietl Oct 19, 2023
6b3e496
Adapt error keys
wmdietl Oct 19, 2023
107b4a4
Different attempt to get the -plus versions working
wmdietl Oct 19, 2023
29b2890
Update date
wmdietl Oct 19, 2023
60b681a
Add todo to example
wmdietl Oct 19, 2023
b259610
Add/fix visibility
wmdietl Oct 19, 2023
7fa9720
Fix typo
wmdietl Oct 19, 2023
9cecf34
Use consistent relocate clause
wmdietl Oct 19, 2023
8594983
Put skip-test directives at the beginning of the file
wmdietl Oct 19, 2023
56f293e
Add comment about stubparser dependency
wmdietl Oct 19, 2023
2d26a0d
Add todo for deconstructor patterns
wmdietl Oct 19, 2023
8dc21dc
Actually add deconstructor pattern nodes to the CFG
wmdietl Oct 19, 2023
373f7db
Don't fail CI on jdk-next
wmdietl Oct 19, 2023
ed5b510
Undo incorrect fix
wmdietl Oct 19, 2023
3790245
Handle exception in declaration, not call site
wmdietl Oct 19, 2023
32faf01
javaCompiler can't be set in Gradle on Java 8
wmdietl Oct 19, 2023
62fda02
Only use assembleForJavac for CI
wmdietl Oct 19, 2023
fa73525
Consistently relocate packages
wmdietl Oct 19, 2023
d3a3eaa
Fix relocate instruction
wmdietl Oct 20, 2023
ab02b19
Ignore follow-on errors in CI
wmdietl Oct 21, 2023
b923cb9
Document new false positives in tests
wmdietl Oct 21, 2023
e062963
Remove spurious stack trace
wmdietl Oct 21, 2023
2d68654
Move methods to better place, fix date formats
wmdietl Oct 21, 2023
72e285b
UPPER_CASE public static final fields
wmdietl Oct 21, 2023
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
578 changes: 373 additions & 205 deletions azure-pipelines.yml

Large diffs are not rendered by default.

137 changes: 60 additions & 77 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ apply plugin: 'de.undercouch.download'

// There is another `repositories { ... }` block below; if you change this one, change that one as well.
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'}
mavenCentral()
}

Expand All @@ -45,8 +46,10 @@ ext {
isJava18 = JavaVersion.current() == JavaVersion.VERSION_18
isJava19 = JavaVersion.current() == JavaVersion.VERSION_19
isJava20 = JavaVersion.current() == JavaVersion.VERSION_20
isJava21 = JavaVersion.current() == JavaVersion.VERSION_21

isJava20plus = isJava20
isJava21plus = isJava21
isJava20plus = isJava20 || isJava21plus
isJava19plus = isJava19 || isJava20plus
isJava18plus = isJava18 || isJava19plus
isJava17plus = isJava17 || isJava18plus
Expand All @@ -55,27 +58,19 @@ ext {
isJava14plus = isJava14 || isJava15plus
isJava11plus = JavaVersion.current() >= JavaVersion.VERSION_11

// As of 2022-04-22, delombok doesn't yet support JDK 20; see https://projectlombok.org/changelog .
// Keep the variable in case we need to disable lombok for a future Java release.
skipDelombok = JavaVersion.current() >= JavaVersion.VERSION_20

// This call to `isCompatibleWith` causes a Gradle run-time failure: "No signature of method".
// isJava17compatible = JavaVersion.isCompatibleWith(JavaVersion.VERSION_17)
// isJava17orHigher = JavaVersion.current() >= JavaVersion.VERSION_17
// As of 2023-09-23, delombok doesn't yet support JDK 22; see https://projectlombok.org/changelog .
skipDelombok = JavaVersion.current() > JavaVersion.VERSION_21

parentDir = file("${rootDir}/../").absolutePath

// NO-AFU
// annotationTools = "${parentDir}/annotation-tools"
// afu = "${annotationTools}/annotation-file-utilities"

stubparser = "${parentDir}/stubparser"
stubparserVersion = "3.25.5"
stubparserJar = "${stubparser}/javaparser-core/target/stubparser-${stubparserVersion}.jar"

jtregHome = "${parentDir}/jtreg"
plumeScriptsHome = "${project(':checker').projectDir}/bin-devel/.plume-scripts"
htmlToolsHome = "${project(':checker').projectDir}/bin-devel/.html-tools"
doLikeJavacHome = "${project(':checker').projectDir}/bin/.do-like-javac"

javadocMemberLevel = JavadocMemberLevel.PROTECTED

Expand Down Expand Up @@ -163,7 +158,7 @@ allprojects {
// * 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.38.0'
version '3.39.0'

tasks.withType(JavaCompile).configureEach {
options.fork = true
Expand All @@ -179,6 +174,7 @@ allprojects {

// Keep in sync with "repositories { ... }" block above.
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'}
mavenCentral()
}

Expand Down Expand Up @@ -270,6 +266,15 @@ allprojects {
// added in Java 14, not Java 17.
doNotFormat += ['**/java17/']
}
// As of 2023-09-24, google-java-format cannot parse Java 21 language features.
// See https://github.com/google/google-java-format/releases.
if (true) {
doNotFormat += ['**/java21/']
}
if (!isJava21plus) {
doNotFormat += ['**/java21/']
}


format 'misc', {
// define the files to apply `misc` to
Expand Down Expand Up @@ -380,6 +385,16 @@ allprojects {
// Add standard javac options
tasks.withType(JavaCompile) { compilationTask ->
dependsOn(':installGitHooks')
boolean jdk17Compiler = project.getProperties().getOrDefault('useJdk17Compiler', false)
if (!isJava8 && jdk17Compiler) {
// This uses the Java 17 compiler to compile all code.
// https://docs.gradle.org/current/userguide/toolchains.html
// This property is final on Java 8, so don't set it then.
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
}

// Sorting is commented out because it disables incremental compilation.
// Uncomment when needed.
// // Put source files in deterministic order, for debugging.
Expand Down Expand Up @@ -435,14 +450,19 @@ allprojects {

options.failOnError = true
options.deprecation = true
// -options: To not get a warning about missing bootstrap classpath (when using Java 9 and `-source 8`).
// -fallthrough: Don't check fallthroughs. Instead, use Error Prone. Its
// warnings are suppressible with a "// fall through" comment.
// -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452
String lint = '-Xlint:-options,-fallthrough,-classfile'
if (isJava21plus && !jdk17Compiler) {
// TODO: Ignore this-escape for now, we may want to review and suppress each one later.
lint +=',-this-escape'
}
options.compilerArgs += [
'-g',
'-Werror',
// -options: To not get a warning about missing bootstrap classpath (when using Java 9 and `-source 8`).
// -fallthrough: Don't check fallthroughs. Instead, use Error Prone. Its
// warnings are suppressible with a "// fall through" comment.
// -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452
'-Xlint:-options,-fallthrough,-classfile',
lint,
'-Xlint',
]

Expand Down Expand Up @@ -517,46 +537,6 @@ task cloneAndBuildDependencies(type: Exec, group: 'Build') {
executable 'checker/bin-devel/build.sh'
}

task maybeCloneAndBuildDependencies() {
// No group so it does not show up in the output of `gradlew tasks`
description 'Clones (or updates) and builds all dependencies if they are not present.'
onlyIf {
!file(stubparserJar).exists()
// The jdk repository is cloned via the copyAndMinimizeAnnotatedJdkFiles task that is run if
// the repository does not exist when building checker.jar.
}

doFirst {
if (file(stubparser).exists()) {
exec {
workingDir stubparser
executable 'git'
args = ['pull', '-q']
ignoreExitValue = true // because of the doLast block below
}
exec {
workingDir stubparser
executable "${stubparser}/.build-without-test.sh"
}
} else {
exec {
executable 'checker/bin-devel/build.sh'
}
}
}
doLast {
if (!file(stubparserJar).exists()) {
println "The contents of ${stubparser}/javaparser-core/target (which does not contain stubparser-${stubparserVersion}.jar!) are:"
exec {
workingDir "${stubparser}/javaparser-core/target"
executable 'ls'
ignoreExitValue = true
}
throw new RuntimeException('Can\'t find stubparser jar: ' + stubparserJar + '; are you using an out-of-date Checker Framework or Stubparser?')
}
}
}

task version(group: 'Documentation') {
description 'Print Checker Framework version'
doLast {
Expand Down Expand Up @@ -832,6 +812,7 @@ def createCloneTask(taskName, url, directory, extraArgs = []) {

createCloneTask('getPlumeScripts', 'https://github.com/eisop-plume-lib/plume-scripts.git', plumeScriptsHome)
createCloneTask('getHtmlTools', 'https://github.com/plume-lib/html-tools.git', htmlToolsHome)
createCloneTask('getDoLikeJavac', 'https://github.com/opprop/do-like-javac.git', doLikeJavacHome)


// No group so it does not show up in the output of `gradlew tasks`
Expand Down Expand Up @@ -963,27 +944,30 @@ subprojects {
[
'-Astubs=javax-lang-model-element-name.astub'
])
createCheckTypeTask(project.name, 'NullnessOnlyAnnotatedFor',
'org.checkerframework.checker.nullness.NullnessChecker',
[
'-AskipUses=com\\.sun\\.*',
// If a file does not contain @AnnotatedFor("nullness"), all its routines are assumed to return @Nullable.
'-AuseConservativeDefaultsForUncheckedCode=source'
])
createCheckTypeTask(project.name, 'Purity',
'org.checkerframework.framework.util.PurityChecker')
createCheckTypeTask(project.name, 'ResourceLeak',
'org.checkerframework.checker.resourceleak.ResourceLeakChecker')
createCheckTypeTask(project.name, 'Signature',
'org.checkerframework.checker.signature.SignatureChecker')
// These pass on some subprojects, which the `typecheck` task runs.
// TODO: Incrementally add @AnnotatedFor on more classes.
createCheckTypeTask(project.name, 'Nullness',
'org.checkerframework.checker.nullness.NullnessChecker',
[
'-AskipUses=com.sun.*',
'-AconservativeArgumentNullnessAfterInvocation=true'
])

if (project.name.is('framework') || project.name.is('checker')) {
createCheckTypeTask(project.name, 'Nullness',
'org.checkerframework.checker.nullness.NullnessChecker',
[
'-AskipUses=com\\.sun\\.*',
// If a file does not contain @AnnotatedFor("nullness"), all its routines are assumed to return @Nullable.
'-AuseConservativeDefaultsForUncheckedCode=source',
'-AconservativeArgumentNullnessAfterInvocation=true',
])
} else {
createCheckTypeTask(project.name, 'Nullness',
'org.checkerframework.checker.nullness.NullnessChecker',
[
'-AskipUses=com\\.sun\\.*',
'-AconservativeArgumentNullnessAfterInvocation=true'
])
}


// Add jtregTests to framework and checker modules
Expand All @@ -1005,7 +989,7 @@ subprojects {
"-dir:${projectDir}/jtreg",
"-workDir:${jtregOutput}/${name}/work",
"-reportDir:${jtregOutput}/${name}/report",
'-verbose:error,fail',
'-verbose:error,fail,nopass',
// Don't add debugging information
// '-javacoptions:-g',
'-keywords:!ignore',
Expand Down Expand Up @@ -1189,10 +1173,9 @@ subprojects {
description 'Run the Checker Framework on itself (part 2)'
dependsOn('checkResourceLeak', 'checkSignature')
if (project.name.is('framework') || project.name.is('checker')) {
dependsOn('checkNullnessOnlyAnnotatedFor', 'checkCompilerMessages')
} else {
dependsOn('checkNullness')
dependsOn('checkCompilerMessages')
}
dependsOn('checkNullness')
}

// Create an allTests task per project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
@Repeatable(EnsuresCalledMethods.List.class)
public @interface EnsuresCalledMethods {
/**
* The Java expressions to which the qualifier applies.
* The Java expressions that will have methods called on them.
*
* @return the Java expressions to which the qualifier applies
* @return the Java expressions that will have methods called on them
* @see org.checkerframework.framework.qual.EnsuresQualifier
*/
// Postconditions must use "value" as the name (conditional postconditions use "expression").
Expand Down
11 changes: 10 additions & 1 deletion checker/bin-devel/Dockerfile-README
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ export JDKVER=jdk17-plus
export PROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk21
export PROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk21-plus
export PROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk-latest
export PROJECT=cf
Expand All @@ -81,7 +91,6 @@ export JDKVER=jdk-next-plus
export PROJECT=cf
create_upload_docker_image


Use numbered JDK releases for versions that should be supported longer term.
jdk-latest is for the latest release and jdk-next is for pre-releases of
the upcoming release.
Expand Down
42 changes: 27 additions & 15 deletions checker/bin-devel/Dockerfile-ubuntu-jdk-latest
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Create a Docker image that is ready to run the main Checker Framework tests,
# using the latest OpenJDK release, currently OpenJDK 19.
# using the latest OpenJDK release, currently OpenJDK 21.

# "ubuntu" is the latest LTS release. "ubuntu:rolling" is the latest release.
# See releases at https://hub.docker.com/_/ubuntu for available images.
# See https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=openjdk-20-jdk&searchon=names
# See https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=openjdk-21-jdk&searchon=names
# to see what Ubuntu versions support a particular OpenJDK version.
FROM ubuntu:22.10
FROM ubuntu:23.10
MAINTAINER Werner Dietl <[email protected]>

# According to
Expand All @@ -15,37 +15,49 @@ MAINTAINER Werner Dietl <[email protected]>

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& apt-get -qqy install \
openjdk-19-jdk
&& apt-get -y install aptitude \
&& aptitude -y install \
apt-utils

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& apt-get -qqy install \
&& aptitude -y install \
openjdk-17-jdk \
openjdk-21-jdk

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& aptitude -y install \
ant \
binutils \
build-essential \
cpp \
git \
gradle \
jq \
libcurl3-gnutls \
make \
maven \
mercurial \
python3-pip \
pipx \
python3-distutils \
python3-requests \
unzip \
wget

# Maven 3.6.3 (the default on Ubuntu 22.04) does not run under JDK 19.
# Maven 3.8.7 is the default on Ubuntu 23.04, so the below is not needed.
# (Don't try to use a variable here for the Maven version.)
RUN export DEBIAN_FRONTEND=noninteractive \
&& wget https://mirrors.sonic.net/apache/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz \
&& tar xzvf apache-maven-3.9.1-bin.tar.gz
ENV PATH="/apache-maven-3.9.1/bin:$PATH"
# RUN export DEBIAN_FRONTEND=noninteractive \
# && wget https://mirrors.sonic.net/apache/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz \
# && tar xzvf apache-maven-3.9.2-bin.tar.gz
# ENV PATH="/apache-maven-3.9.2/bin:$PATH"

ENV PATH="/root/.local/bin:$PATH"
RUN pipx install --pip-args="--no-cache-dir" lithium-reducer

RUN pip3 install --no-cache-dir lithium-reducer PyGithub pyyaml
RUN mkdir /python-env \
&& python3 -m venv /python-env \
&& /python-env/bin/pip install --no-cache-dir lithium-reducer PyGithub pyyaml

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Loading
Loading