Skip to content

Commit

Permalink
Miscellaneous cleanups for supporting JDK 18 (#5345)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Sep 29, 2022
1 parent df157d3 commit 04f831b
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 29 deletions.
12 changes: 3 additions & 9 deletions build.gradle
Expand Up @@ -55,21 +55,15 @@ ext {
// Keep in sync with check in
// framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java .
switch (JavaVersion.current()) {
case JavaVersion.VERSION_1_9:
case JavaVersion.VERSION_1_10:
case JavaVersion.VERSION_12:
case JavaVersion.VERSION_19:
case JavaVersion.VERSION_20:
logger.note("The Checker Framework has only been tested with JDK 8, 11, 17, and 18." +
" You are using JDK " + JavaVersion.current().majorVersion + ".");
break;
case JavaVersion.VERSION_1_8:
case JavaVersion.VERSION_11:
case JavaVersion.VERSION_17:
case JavaVersion.VERSION_18:
break; // Supported versions
default:
throw new GradleException("Unexpected Java version found: " + JavaVersion.current().majorVersion);
logger.info("The Checker Framework has only been tested with JDK 8, 11, 17, and 18." +
" You are using JDK " + JavaVersion.current().majorVersion + ".");
break;
}

task setLocalRepo(type:Exec) {
Expand Down
1 change: 1 addition & 0 deletions checker/bin-devel/build.sh
Expand Up @@ -12,6 +12,7 @@ echo "CHECKERFRAMEWORK=$CHECKERFRAMEWORK"
export SHELLOPTS
echo "SHELLOPTS=${SHELLOPTS}"

echo "initial JAVA_HOME=${JAVA_HOME}"
if [ "$(uname)" == "Darwin" ] ; then
export JAVA_HOME=${JAVA_HOME:-$(/usr/libexec/java_home)}
else
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/fenum/UpperBoundsInByteCode.java
@@ -1,4 +1,4 @@
// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

import org.checkerframework.checker.fenum.qual.Fenum;
import org.checkerframework.framework.testchecker.lib.UncheckedByteCode;
Expand Down
2 changes: 1 addition & 1 deletion checker/tests/mustcall/CommandResponse.java
@@ -1,6 +1,6 @@
// Based on a false positive in Zookeeper.

// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

import java.util.Map;

Expand Down
2 changes: 1 addition & 1 deletion checker/tests/nullness/Issue3754.java
@@ -1,4 +1,4 @@
// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

import org.checkerframework.checker.nullness.qual.Nullable;

Expand Down
2 changes: 1 addition & 1 deletion checker/tests/nullness/Iterate.java
@@ -1,4 +1,4 @@
// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

package wildcards;

Expand Down
2 changes: 1 addition & 1 deletion checker/tests/nullness/RawTypesNullness.java
@@ -1,4 +1,4 @@
// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false negatives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false negatives may be due to issue #979

import org.checkerframework.checker.nullness.qual.Nullable;

Expand Down
2 changes: 1 addition & 1 deletion checker/tests/nullness/java8inference/Issue980.java
@@ -1,7 +1,7 @@
// Test case that was submitted in Issue 402, but was combined with Issue 979
// https://github.com/typetools/checker-framework/issues/979

// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

import java.util.List;
import java.util.stream.Collectors;
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/inference.tex
Expand Up @@ -238,10 +238,10 @@
\item The project on which inference is run must contain an Ant, Gradle,
or Maven buildfile that compiles the project.
\item At least one of the \verb|JAVA_HOME|,
\verb|JAVA8_HOME|, \verb|JAVA11_HOME|, or \verb|JAVA17_HOME|
\verb|JAVA8_HOME|, \verb|JAVA11_HOME|, \verb|JAVA17_HOME|, or \verb|JAVA18_HOME|
environment variables must be set.
\item If set, the \verb|JAVA_HOME| environment variable must point to a
Java 8, 11, or 18 JDK.
Java 8, 11, 17, or 18 JDK.
\item If set, the \verb|JAVA8_HOME| environment variable must point to a Java 8 JDK.
\item If set, the \verb|JAVA11_HOME| environment variable must point to a Java 11 JDK.
\item If set, the \verb|JAVA17_HOME| environment variable must point to a Java 17 JDK.
Expand Down
6 changes: 1 addition & 5 deletions docs/manual/introduction.tex
Expand Up @@ -824,7 +824,7 @@


Here are some standard javac command-line options that you may find useful.
Many of them contain the word ``processor'', because in javac jargon, a
Many of them contain ``processor'' or ``proc'', because in javac jargon, a
checker is an ``annotation processor''.

\begin{itemize}
Expand Down Expand Up @@ -854,10 +854,6 @@
the compiler or a checker.
\end{itemize}

The Checker Framework does not support \<-source 1.7> or earlier. You must
supply \<-source 1.8> or later, or no \<-source> command-line argument,
when running \<javac>.


\subsectionAndLabel{Checker auto-discovery}{checker-auto-discovery}

Expand Down
2 changes: 1 addition & 1 deletion docs/manual/troubleshooting.tex
Expand Up @@ -711,7 +711,7 @@
\item[Ubuntu]
Run the following commands, which should be the same as those in
\<checker/bin-devel/Dockerfile-ubuntu-jdk\emph{XX}-plus>, where \emph{XX}
is a JDK version such as 8, 11, 17, 18, etc.:
is a JDK version such as 8, 11, 17, etc.:
(This list should be the same as in
\<checker/bin-devel/Dockerfile-ubuntu-jdk17-plus>; if your build fails
Expand Down
Expand Up @@ -550,8 +550,8 @@ public final synchronized void init(ProcessingEnvironment env) {
if (jreVersion != 8 && jreVersion != 11 && jreVersion != 17 && jreVersion != 18) {
message(
(hasOption("permitUnsupportedJdkVersion") ? Kind.NOTE : Kind.WARNING),
"The Checker Framework is tested with JDK 8, 11, 17, and 18. You are using version"
+ " %d.",
"The Checker Framework is tested with JDK 8, 11, 17, and 18."
+ " You are using version %d.",
jreVersion);
}

Expand Down
Expand Up @@ -358,7 +358,8 @@ public static ParserConfiguration.LanguageLevel getCurrentSourceVersion(
case "RELEASE_17":
currentSourceVersion = ParserConfiguration.LanguageLevel.JAVA_17;
break;
// JavaParser does not yet have a constant for JDK 18. The default is JAVA_17.
// As of 2022-09-27, JavaParser's ParserConfiguration.LanguageLevel does not yet have a
// constant for JDK 18.
// case "RELEASE_18":
// currentSourceVersion = ParserConfiguration.LanguageLevel.JAVA_18;
// break;
Expand Down
2 changes: 1 addition & 1 deletion framework/tests/all-systems/LubRawTypes.java
@@ -1,4 +1,4 @@
// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

@SuppressWarnings("unchecked")
public class LubRawTypes {
Expand Down
2 changes: 1 addition & 1 deletion framework/tests/all-systems/java8inference/Issue1397.java
@@ -1,7 +1,7 @@
// Test case for Issue 1397.
// https://github.com/typetools/checker-framework/issues/1397

// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

public class Issue1397 {

Expand Down
2 changes: 1 addition & 1 deletion framework/tests/all-systems/java8inference/Issue1407.java
@@ -1,7 +1,7 @@
// Test case for Issue 1407.
// https://github.com/typetools/checker-framework/issues/1407

// @above-java17-jdk-skip-test TODO: reinstate on JDK 18, false positives may be due to issue #979
// @above-java17-jdk-skip-test TODO: reinstate, false positives may be due to issue #979

abstract class Issue1407 {
abstract <T> T foo(T p1, T p2);
Expand Down

0 comments on commit 04f831b

Please sign in to comment.