Skip to content

Commit 4efdbdb

Browse files
authored
Remove support for Java 8 from scripts and build scripts. (#7575)
1 parent dee7b36 commit 4efdbdb

12 files changed

Lines changed: 48 additions & 150 deletions

File tree

annotation-file-utilities/bin/extract-annotations

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,9 @@ done
3030
AFU=${AFU:-$(dirname "$0")/..}
3131
ANNOTATION_FILE_UTILS=${AFU}/dist/annotation-file-utilities-all.jar
3232

33-
JAVAC_JAR=${JAVAC_JAR:-${AFU}/lib/javac-9+181-r4173-1.jar}
34-
35-
if java -version 2>&1 | grep version | grep 1.8 > /dev/null; then
36-
# Using JDK 8. -Xbootclasspth isn't supported in 9+ and isn't required.
37-
BOOTCLASSPATH=-Xbootclasspath/p:${JAVAC_JAR}
38-
JDK_OPENS=
39-
else
40-
BOOTCLASSPATH=
41-
# Need open to access CommandLine.parse dynamically to check its type:
42-
JDK_OPENS="--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED"
43-
fi
33+
BOOTCLASSPATH=
34+
# Need open to access CommandLine.parse dynamically to check its type:
35+
JDK_OPENS="--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED"
4436

4537
if [ "$DEBUG" = "1" ]; then
4638
echo "--- start of extract-annotations debugging output"

annotation-file-utilities/bin/extract-annotations.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
set ANNOTATION_FILE_UTILS=%~d0
77
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%%~p0
88
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%\..\dist\annotation-file-utilities-all.jar
9-
set JAVAC_JAR=%ANNOTATION_FILE_UTILS%\annotation-file-utilities\lib\javac-9+181-r4173-1.jar
109

11-
java -ea -cp "%JAVAC_JAR%;%ANNOTATION_FILE_UTILS%;%CLASSPATH%" ClassFileReader %*
10+
set JDK_OPENS=--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED
11+
java -ea %JDK_OPENS% -cp "%ANNOTATION_FILE_UTILS%;%CLASSPATH%" ClassFileReader %*
1212

annotation-file-utilities/bin/insert-annotations

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,11 @@ done
2929

3030
AFU=${AFU:-$(dirname "$0")/..}
3131
ANNOTATION_FILE_UTILS="${AFU}/dist/annotation-file-utilities-all.jar"
32-
JAVAC_JAR="${JAVAC_JAR:-${AFU}/lib/javac-9+181-r4173-1.jar}"
33-
34-
if java -version 2>&1 | grep version | grep 1.8 > /dev/null; then
35-
# Using JDK 8. -Xbootclasspth isn't supported in 9+ and isn't required.
36-
BOOTCLASSPATH="-Xbootclasspath/p:${JAVAC_JAR}"
37-
fi
3832

3933
if [ "$DEBUG" = "1" ]; then
4034
echo "--- start of insert-annotations debugging output"
4135
echo "AFU=${AFU}"
4236
echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
43-
echo "JAVAC_JAR=${JAVAC_JAR}"
4437
# Keep this in sync with the actual command below.
4538
echo "java -ea ${BOOTCLASSPATH} -cp ${ANNOTATION_FILE_UTILS}:${CLASSPATH} org.checkerframework.afu.scenelib.io.classfile.ClassFileWriter" "$@"
4639
echo "--- end of insert-annotations debugging output"

annotation-file-utilities/bin/insert-annotations-to-source

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,19 @@ AFUSCRIPTS=$(dirname "$0")
3131
AFU=$(cd "$AFUSCRIPTS/.." > /dev/null 2>&1 && pwd)
3232

3333
ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS:-${AFU}/dist/annotation-file-utilities-all.jar}
34-
JAVAC_JAR=${JAVAC_JAR:-${AFU}/lib/javac-9+181-r4173-1.jar}
3534

36-
if java -version 2>&1 | grep version | grep 1.8 > /dev/null; then
37-
# Using JDK 8.
38-
BOOTCLASSPATH=-Xbootclasspath/p:${JAVAC_JAR}
39-
JDK_OPENS=
40-
else
41-
# Using JDK 9 or later. -Xbootclasspth isn't supported in 9+ and isn't required.
42-
BOOTCLASSPATH=
43-
# Need open to access CommandLine.parse dynamically to check its type:
44-
JDK_OPENS="--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED"
45-
fi
35+
BOOTCLASSPATH=
36+
# Need open to access CommandLine.parse dynamically to check its type:
37+
JDK_OPENS="--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED"
4638

4739
if [ "$DEBUG" = "1" ]; then
4840
echo "--- start of insert-annotations-to-source debugging output"
4941
echo "AFU=${AFU}"
5042
echo "ANNOTATION_FILE_UTILS=${ANNOTATION_FILE_UTILS}"
51-
echo "JAVAC_JAR=${JAVAC_JAR}"
5243
echo "CLASSPATH=${CLASSPATH}"
5344
# Keep this in sync with the actual command below.
5445
# shellcheck disable=SC2181 disable=SC2086
55-
echo about to run: java -ea -Xmx4g ${BOOTCLASSPATH} ${JDK_OPENS} -classpath "${JAVAC_JAR}:${ANNOTATION_FILE_UTILS}:${CLASSPATH}" org.checkerframework.afu.annotator.Main "$@"
46+
echo about to run: java -ea -Xmx4g ${BOOTCLASSPATH} ${JDK_OPENS} -classpath "${ANNOTATION_FILE_UTILS}:${CLASSPATH}" org.checkerframework.afu.annotator.Main "$@"
5647
echo "--- end of insert-annotations-to-source debugging output"
5748
# echo "--- start of input files"
5849
# for file in "$@"; do
@@ -66,4 +57,4 @@ fi
6657

6758
# Augment, don't replace, CLASSPATH, so as to find user files.
6859
# shellcheck disable=SC2181 disable=SC2086 # ${BOOTCLASSPATH} and ${JDK_OPENS} might be empty and must not be quoted.
69-
java -ea -Xmx4g ${BOOTCLASSPATH} ${JDK_OPENS} -classpath "${JAVAC_JAR}:${ANNOTATION_FILE_UTILS}:${CLASSPATH}" org.checkerframework.afu.annotator.Main "$@"
60+
java -ea -Xmx4g ${BOOTCLASSPATH} ${JDK_OPENS} -classpath "${ANNOTATION_FILE_UTILS}:${CLASSPATH}" org.checkerframework.afu.annotator.Main "$@"

annotation-file-utilities/bin/insert-annotations-to-source.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
set ANNOTATION_FILE_UTILS=%~d0
66
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%%~p0
77
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%\..\dist\annotation-file-utilities-all.jar
8-
set JAVAC_JAR=%ANNOTATION_FILE_UTILS%\annotation-file-utilities\lib\javac-9+181-r4173-1.jar
98

10-
java -ea -cp "%JAVAC_JAR%;%ANNOTATION_FILE_UTILS%;%CLASSPATH%" org.checkerframework.afu.annotator.Main %*
9+
set JDK_OPENS=--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED
10+
java -ea %JDK_OPENS% -cp "%ANNOTATION_FILE_UTILS%;%CLASSPATH%" org.checkerframework.afu.annotator.Main %*

annotation-file-utilities/bin/insert-annotations.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
set ANNOTATION_FILE_UTILS=%~d0
88
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%%~p0
99
set ANNOTATION_FILE_UTILS=%ANNOTATION_FILE_UTILS%\..\dist\annotation-file-utilities-all.jar
10-
set JAVAC_JAR=%ANNOTATION_FILE_UTILS%\annotation-file-utilities\lib\javac-9+181-r4173-1.jar
1110

12-
java -ea -cp "%JAVAC_JAR%;%ANNOTATION_FILE_UTILS%;%CLASSPATH%" ClassFileWriter %*
11+
java -ea -cp "%ANNOTATION_FILE_UTILS%;%CLASSPATH%" ClassFileWriter %*

annotation-file-utilities/lib/README

Lines changed: 0 additions & 3 deletions
This file was deleted.
-6.57 MB
Binary file not shown.

build.gradle

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ ext {
4141
// or
4242
// ./gradlew sometask -PuseJdk21Compiler=true
4343

44-
gradleRunsOnJava17orHigher = JavaVersion.current() >= JavaVersion.VERSION_17
4544
gradleRunsOnJava21orHigher = JavaVersion.current() >= JavaVersion.VERSION_21
4645
gradleRunsOnJava22orHigher = JavaVersion.current() >= JavaVersion.VERSION_22
4746
gradleRunsOnJava24orHigher = JavaVersion.current() >= JavaVersion.VERSION_24
@@ -156,9 +155,6 @@ allprojects { currentProj ->
156155
}
157156

158157
configurations {
159-
// This is required to run the Checker Framework on JDK 8.
160-
javacJar
161-
162158
// Holds the combined classpath of all subprojects including the subprojects themselves.
163159
allProjects
164160

@@ -173,8 +169,6 @@ allprojects { currentProj ->
173169
dependencies {
174170
errorprone(libs.error.prone.core)
175171

176-
javacJar(libs.javac)
177-
178172
allProjects(subprojects)
179173
}
180174

@@ -847,15 +841,24 @@ subprojects {
847841
// When you add one here, also update a dependsOn(item for the "typecheck" task.)
848842
createCheckTypeTask(project.name, "Formatter",
849843
"org.checkerframework.checker.formatter.FormatterChecker")
844+
845+
def checkInterningArgs = [
846+
"-Astubs=javax-lang-model-element-name.astub"
847+
]
848+
if ((project.name.equals("checker-qual")
849+
|| project.name.equals("checker-util")
850+
|| project.name.equals("checker-qual-android"))) {
851+
// Because these projects use --release=11, the stubparser issues warnings like:
852+
// warning: javax-lang-model-element-name.astub:(line 11,col 1): Package not found: com.sun.tools.javac.util
853+
// so just suppress them.
854+
checkInterningArgs += "-AstubNoWarnIfNotFound"
855+
}
856+
857+
850858
createCheckTypeTask(project.name, "Interning",
851859
"org.checkerframework.checker.interning.InterningChecker",
852-
[
853-
"-Astubs=javax-lang-model-element-name.astub",
854-
// The stubparser gives a warning on the package, but the class is still found.
855-
// warning: javax-lang-model-element-name.astub:(line 11,col 1): Package not found: com.sun.tools.javac.util
856-
// 1 error
857-
"-AstubNoWarnIfNotFound"
858-
])
860+
checkInterningArgs)
861+
859862
createCheckTypeTask(project.name, "Optional",
860863
"org.checkerframework.checker.optional.OptionalChecker",
861864
[

checker/build.gradle

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,10 @@ jar {
100100
// It is useful for those who only want to run `javac`.
101101
// checker.jar is copied to checker/dist/ when it is built by the shadowJar task.
102102
tasks.register("assembleForJavac") {
103-
dependsOn(shadowJar)
104103
description = "Builds or downloads jars required by CheckerMain and puts them in checker/dist/."
104+
dependsOn(shadowJar)
105105
dependsOn(project(":checker-qual").tasks.jar)
106106
dependsOn(project(":checker-util").tasks.jar)
107-
108-
doLast {
109-
copy {
110-
// This is required to *run* the Checker Framework on JDK 8.
111-
from(configurations.javacJar)
112-
into("${projectDir}/dist")
113-
rename { String fileName ->
114-
fileName.replace(fileName, "javac.jar")
115-
}
116-
}
117-
}
118107
}
119108

120109
assemble.dependsOn(assembleForJavac)

0 commit comments

Comments
 (0)