Repository navigation
Conversation
📝 WalkthroughWalkthroughThis pull request migrates the Checker Framework to require JDK 21 as the minimum supported version. Changes include: removing Azure pipeline test jobs for JDK 11 and 17, updating build configuration files to set Java 21 compatibility, eliminating the Java 9 module-info compilation logic in checker-qual, and updating documentation to reflect the new JDK 21+ requirement across installation instructions, build tool guidance, and troubleshooting sections. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/manual/external-tools.tex (2)
824-827:⚠️ Potential issue | 🟡 MinorRemove the stale multi-profile / Java 8 wording.
Lines 824-827 still tell readers to create three profiles and handle Java 8 separately, but Line 849 now shows a single
checkerframeworkprofile activated on JDK 21+. The narrative should match the new example.Also applies to: 849-850
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/manual/external-tools.tex` around lines 824 - 827, Update the narrative that instructs creating "three new profiles" and special-casing Java 8 to reflect the current example which uses a single checkerframework profile activated on JDK 21+; remove the stale multi-profile/Java 8 wording and rephrase the paragraph so it directs readers to use the single checkerframework profile (and adjust the adjacent sentence around lines 849-850 to match this single-profile approach).
482-487:⚠️ Potential issue | 🟡 MinorUse "non-exported packages," not "non-exported members."
Line 487 incorrectly states that
--add-exportsis "required because the Checker Framework accesses non-exported members." Per JEP 261 and the Java module system specification,--add-exportsonly exports the public API of a package to another module; accessing non-public members requires--add-opensinstead. The text should say "non-exported packages" to correctly describe what--add-exportsmakes accessible, as that aligns with the distinction already established on line 482 between--add-opens(for private/reflective access) and--add-exports(for package-level access).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/manual/external-tools.tex` around lines 482 - 487, Change the phrasing on the --add-exports bullet to say it is "required because the Checker Framework accesses non-exported packages" (not "non-exported members"); keep the existing distinction with --add-opens (which grants reflective access to private members) and ensure the two bullets reference the flags --add-opens and --add-exports exactly as in the diff so readers understand that --add-opens is for reflective/private member access and --add-exports is for exposing package APIs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle`:
- Around line 296-297: buildSrc is still compiling to Java 17 because its own
build script overrides root settings; open buildSrc/build.gradle and update the
module's sourceCompatibility and targetCompatibility to 21 (or configure the
Java toolchain there using java { toolchain {
languageVersion.set(JavaLanguageVersion.of(21)) } }) so build logic produces
Java 21 bytecode; ensure any compileJava/compileKotlin tasks or
kotlinOptions.release (if present) are aligned to 21 as well.
In `@docs/CHANGELOG.md`:
- Around line 7-8: Add a blank line immediately after the "### User-visible
changes" heading in the changelog so the heading is separated from the paragraph
("The Checker Framework now requires JDK 21+ to use."), which will satisfy
markdownlint MD022; update the docs/CHANGELOG.md content to insert that single
empty line following the "### User-visible changes" heading.
In `@docs/manual/inference.tex`:
- Around line 269-274: The documentation for accepted environment variables is
out of sync with the wpi.sh checker; update the docs (in the inference.tex
section listing JAVA_* variables) to match the exact set of env vars the checker
inspects (e.g. JAVA8_HOME, JAVA11_HOME, JAVA17_HOME, JAVA21_HOME, JAVA24_HOME,
JAVA25_HOME and the behavior of JAVA_HOME), or alternatively update the checker
script (wpi.sh) to recognize the variables called out in the docs (JAVA_HOME,
JAVA21_HOME, JAVA22_HOME); ensure the list of symbols (JAVA_HOME, JAVA8_HOME,
JAVA11_HOME, JAVA17_HOME, JAVA21_HOME, JAVA22_HOME, JAVA24_HOME, JAVA25_HOME)
and the documented rules for which JDK versions each variable must point to are
consistent between inference.tex and wpi.sh.
In `@docs/manual/troubleshooting.tex`:
- Line 838: Update the macOS setup example so the JDK examples are consistent
with "21+"; replace the hardcoded "temurin17" install reference with the
appropriate Temurin 21+ cask (e.g., temurin21) and update the example path
string "adoptopenjdk-XX" to use a 21+ placeholder (e.g., adoptopenjdk-21 or
adoptopenjdk-21+), and change any remaining "XX" occurrences in that subsection
to "21+" so the installed cask and shown PATH match.
---
Outside diff comments:
In `@docs/manual/external-tools.tex`:
- Around line 824-827: Update the narrative that instructs creating "three new
profiles" and special-casing Java 8 to reflect the current example which uses a
single checkerframework profile activated on JDK 21+; remove the stale
multi-profile/Java 8 wording and rephrase the paragraph so it directs readers to
use the single checkerframework profile (and adjust the adjacent sentence around
lines 849-850 to match this single-profile approach).
- Around line 482-487: Change the phrasing on the --add-exports bullet to say it
is "required because the Checker Framework accesses non-exported packages" (not
"non-exported members"); keep the existing distinction with --add-opens (which
grants reflective access to private members) and ensure the two bullets
reference the flags --add-opens and --add-exports exactly as in the diff so
readers understand that --add-opens is for reflective/private member access and
--add-exports is for exposing package APIs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a3632406-7395-45ab-b2f6-0634dd3e1ca4
📒 Files selected for processing (10)
.azure/jobs.m4build.gradlechecker-qual-android/build.gradlechecker-qual/build.gradledocs/CHANGELOG.mddocs/manual/creating-a-checker.texdocs/manual/external-tools.texdocs/manual/inference.texdocs/manual/introduction.texdocs/manual/troubleshooting.tex
💤 Files with no reviewable changes (2)
- .azure/jobs.m4
- checker-qual/build.gradle
|
FWIW, NullAway still supports running on JDK 17. So, if I understand correctly, until we started requiring JDK 21, we wouldn't be able to update our Checker dataflow dependence. This shouldn't block the Checker Framework, just an FYI. I can look more into when NullAway can start requiring JDK 21. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@buildSrc/build.gradle`:
- Around line 12-13: The buildSrc Gradle file only sets
sourceCompatibility/targetCompatibility but doesn't force the compiler JDK,
causing builds to fail on machines running Gradle with older JDKs; update
buildSrc's build.gradle to configure a Java toolchain for Java 21 (via the java
{ toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } } block) so
compilation and compilation tasks use JDK 21 regardless of the Gradle JVM, and
keep or align sourceCompatibility/targetCompatibility with Java 21 (referencing
sourceCompatibility, targetCompatibility, and the buildSrc build.gradle).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c879a56d-146b-4059-a756-047176bf94c0
📒 Files selected for processing (2)
buildSrc/build.gradledocs/manual/troubleshooting.tex
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle`:
- Around line 366-369: The TODOs next to the Error Prone suppression flags
"-Xep:StatementSwitchToExpressionSwitch:OFF" and
"-Xep:PatternMatchingInstanceof:OFF" indicate technical debt now actionable
under JDK 21; create backlog issues to track converting legacy switch statements
to expression switches and replacing instanceof+casts with pattern matching
instanceof, reference these exact suppression keys in each issue, include links
to the build.gradle lines and a short migration plan (scope, estimated effort,
test strategy) and tag them as JDK-21 modernization so reviewers and schedulers
can prioritize follow-up work.
- Around line 295-298: The if-statement formatting in the build.gradle block
around the project.name.equals checks is missing a space after the "if" keyword;
update the conditional that contains project.name.equals("checker-qual") ||
project.name.equals("checker-util") ||
project.name.equals("checker-qual-android") so it reads with a space between
"if" and "(" (e.g., "if ( ... )"), preserving the existing condition and the
options.release = 11 body.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 92b4367f-2d98-4824-a859-8e528a0ffd2d
📒 Files selected for processing (4)
.azure/azure-pipelines.ymlbuild.gradlechecker-qual/build.gradledocs/CHANGELOG.md
💤 Files with no reviewable changes (2)
- .azure/azure-pipelines.yml
- checker-qual/build.gradle
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…rk into java21-bytecodes
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle`:
- Around line 257-259: The exclusion of "module-info.java" is currently added
inside a Javadoc task's doFirst, which mutates behavior at execution time; move
the exclude "**/module-info.java" call out of the doFirst block and apply it
during configuration (e.g. in a tasks.withType(Javadoc).configureEach or similar
Javadoc configuration block) so the pattern is established at configuration time
instead of inside doFirst; update the Javadoc task configuration where doFirst
currently contains exclude "**/module-info.java" to call exclude
"**/module-info.java" directly in the configureEach/Javadoc configuration.
- Around line 295-304: The build uses sourceCompatibility/targetCompatibility =
21 for most projects but that doesn’t enforce a Java 21 API baseline; update the
Gradle logic around project.name, sourceCompatibility/targetCompatibility and
options.release to require using the JDK 21 compiler when --release cannot be
used: add a check for a boolean project property (e.g. useJdk21Compiler or
-PuseJdk21Compiler=true) and if not set fail the build with a clear message for
these modules so compilation runs on JDK 21, or alternatively set
options.release=11 only for the checker-* exceptions and otherwise enforce using
the JDK21 compiler rather than relying solely on
sourceCompatibility/targetCompatibility.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ee192d8e-362a-4e3c-a633-d92734cf53b7
📒 Files selected for processing (3)
build.gradlebuildSrc/build.gradlechecker/src/main/java/org/checkerframework/checker/interning/javax-lang-model-element-name.astub
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@dataflow/src/main/java/org/checkerframework/dataflow/expression/LocalVariable.java`:
- Around line 67-69: The equals/hashCode contract is violated because equals
compares element.getSimpleName() (with ==) while hashCode uses vs.name; fix by
making equals use Objects.equals(element1.getSimpleName(),
element2.getSimpleName()) instead of == and update hashCode to hash the same
name used in equals (use element.getSimpleName() or
Objects.toString(element.getSimpleName(), null) in the hash computation) so both
LocalVariable.equals and LocalVariable.hashCode rely on the identical name
representation; reference LocalVariable.equals, LocalVariable.hashCode,
element.getSimpleName(), vs.name and CFAbstractStore.localVariableValues when
making the change and ensure null-safe comparisons via Objects.equals.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 41ec8e79-b027-421f-a5c2-0736655342fc
📒 Files selected for processing (7)
annotation-file-utilities/src/main/java/org/checkerframework/afu/annotator/find/Insertions.javadataflow/src/main/java/org/checkerframework/dataflow/expression/LocalVariable.javaframework/src/main/java/org/checkerframework/common/reflection/DefaultReflectionResolver.javaframework/src/main/java/org/checkerframework/common/util/count/AnnotationStatistics.javajavacutil/src/main/java/org/checkerframework/javacutil/AnnotationUtils.javajavacutil/src/main/java/org/checkerframework/javacutil/TypeAnnotationUtils.javajavacutil/src/main/java/org/checkerframework/javacutil/TypesUtils.java
💤 Files with no reviewable changes (1)
- javacutil/src/main/java/org/checkerframework/javacutil/TypeAnnotationUtils.java
|
Spring has and will continue to have a Java 17 baseline for some time, this kind of Java 21 minimum requirement is going to create troubles for the server-side ecosystem, I hope this PR will not be merged (for now, of course later the Spring baseline will evolve). |
|
@sdeleuze Can you please clarify what troubles this PR will create? The change with version 4.0 is that to run the Checker Framework, you need to use a JDK 21 or later version of javac. The Checker Framework can run on any Java project, including projects that compile to Java 8, 11, or 17 bytecodes and run on JRE versions 8, 11, or 17. Are you saying that Spring cannot be compiled using a Java 21 compiler, and that furthermore it is impossible for Spring to stay on the 3.x version of the Checker Framework? |
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
build.gradle (2)
257-259:⚠️ Potential issue | 🟡 MinorConfigure the
module-info.javaexclusion before execution.Applying
exclude "**/module-info.java"insidedoFirstmutates the Javadoc source set after Gradle has already finalized task inputs. Filtersourceduring configuration instead.Suggested fix
tasks.withType(Javadoc).configureEach { + source = source.matching { + exclude "**/module-info.java" + } dependsOn(":checker:shadowJar") dependsOn(":framework-test:tagletClasses") doFirst { options.encoding = "UTF-8" if (!name.equals("javadocDoclintAll")) { options.memberLevel = javadocMemberLevel } - // Without the following, Javadoc will error on checker-qual with "error: reference not found" - // on class in checker.jar. - exclude "**/module-info.java" classpath += configurations.named("checkerFatJar").get().asFileTree🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build.gradle` around lines 257 - 259, The Javadoc task is excluding module-info.java too late inside doFirst, which mutates task inputs after Gradle finalization; move the exclusion to the task configuration by filtering the Javadoc task's source (eg. configure the Javadoc task referenced as "javadoc" or any custom Javadoc task and call source = source.filter { !it.path.endsWith('module-info.java') } or use source.exclude("**/module-info.java") during configuration), removing the doFirst-based exclude so the exclusion is part of the task's configured inputs.
295-304:⚠️ Potential issue | 🟠 MajorRequire the JDK 21 compiler here, not just 21 classfiles.
If
jdkTestVersionis 24/25 anduseJdk21Compileris false, this still compiles with a newerjavacwhile only lowering the emitted classfile version. That can leak post-21 JDK APIs into artifacts that claim Java 21 compatibility.Suggested guard
if ((project.name.equals("checker-qual") || project.name.equals("checker-util") || project.name.equals("checker-qual-android"))) { options.release = 11 } else { + if (compilerJdkVersion != 21) { + throw new GradleException( + "These modules must be compiled with JDK 21 to guarantee a Java 21 API baseline. " + + "Re-run with -PuseJdk21Compiler=true or -PjdkTestVersion=21.") + } sourceCompatibility = 21 targetCompatibility = 21 // Can't use --release with --add-exports, otherwise you'll see errors like: // error: exporting a package from system module jdk.compiler is not allowed with --release🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build.gradle` around lines 295 - 304, The build currently only forces classfile version (sourceCompatibility/targetCompatibility = 21) which allows a newer javac to compile against post-21 APIs; change the Gradle configuration so that when not in the checker-qual projects you enforce using the JDK 21 compiler (e.g., wire the Java toolchain or set options.release = 21 on JavaCompile) rather than just setting sourceCompatibility/targetCompatibility, and guard this behavior behind the existing jdkTestVersion/useJdk21Compiler flags so that when useJdk21Compiler is true (or jdkTestVersion indicates 21) the build uses the JDK 21 compiler/toolchain; update the block handling options.release/sourceCompatibility/targetCompatibility to apply options.release = 21 (or configure javaToolchains.languageVersion = JavaLanguageVersion.of(21)) when appropriate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/CHANGELOG.md`:
- Around line 10-17: The changelog entry is unclear about which artifacts remain
on Java 11 and which moved to JDK 21; update the paragraph to explicitly state
that all published artifacts now target Java 21 except for checker-qual,
checker-qual-android, and checker-util which remain on Java 11 bytecode, and
mention that downstream users may need JDK 21 to run the launcher and other
artifacts; reference the existing terms "JDK 21", "checker-qual.jar",
"checker-qual-android", and "checker-util.jar" (or their artifact names) when
clarifying compatibility and the breaking change so readers can immediately see
the exception list and required Java versions.
In `@docs/manual/external-tools.tex`:
- Around line 487-488: Update the docs entry for the --add-exports bullet to
state that it exposes public types and their public members (not non-public
members) to other modules; change the phrasing around the \item
\<-J--add-exports=...=ALL-UNNAMED> line so it clearly distinguishes
--add-exports (exposes public types/public members) from --add-opens (permits
reflective access to non-public members), and ensure the example text refers to
public API exposure rather than accessing non-exported members.
---
Duplicate comments:
In `@build.gradle`:
- Around line 257-259: The Javadoc task is excluding module-info.java too late
inside doFirst, which mutates task inputs after Gradle finalization; move the
exclusion to the task configuration by filtering the Javadoc task's source (eg.
configure the Javadoc task referenced as "javadoc" or any custom Javadoc task
and call source = source.filter { !it.path.endsWith('module-info.java') } or use
source.exclude("**/module-info.java") during configuration), removing the
doFirst-based exclude so the exclusion is part of the task's configured inputs.
- Around line 295-304: The build currently only forces classfile version
(sourceCompatibility/targetCompatibility = 21) which allows a newer javac to
compile against post-21 APIs; change the Gradle configuration so that when not
in the checker-qual projects you enforce using the JDK 21 compiler (e.g., wire
the Java toolchain or set options.release = 21 on JavaCompile) rather than just
setting sourceCompatibility/targetCompatibility, and guard this behavior behind
the existing jdkTestVersion/useJdk21Compiler flags so that when useJdk21Compiler
is true (or jdkTestVersion indicates 21) the build uses the JDK 21
compiler/toolchain; update the block handling
options.release/sourceCompatibility/targetCompatibility to apply options.release
= 21 (or configure javaToolchains.languageVersion = JavaLanguageVersion.of(21))
when appropriate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6a0af81d-fe07-438f-8d70-6e2f37c4bb4e
📒 Files selected for processing (3)
build.gradledocs/CHANGELOG.mddocs/manual/external-tools.tex
| To run the Checker Framework, you need to use a JDK 21 or later version of | ||
| javac. The Checker Framework can run on any Java project, including projects | ||
| that compile to Java 8, 11, or 17 bytecodes and run on JRE versions 8, 11, or | ||
| 17. | ||
|
|
||
| The type qualifiers and utility libraries in `checker-qual.jar` and | ||
| `checker-util.jar` still use Java 11 bytecode. Thus, they may be included in | ||
| projects that run under an earlier version of Java. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find and examine build.gradle to check Java version configuration
find . -name "build.gradle*" -type f | head -20Repository: typetools/checker-framework
Length of output: 445
🏁 Script executed:
# Check the current CHANGELOG.md content at lines 10-17
if [ -f "docs/CHANGELOG.md" ]; then
sed -n '10,17p' docs/CHANGELOG.md
fiRepository: typetools/checker-framework
Length of output: 504
🏁 Script executed:
# Get a broader view of the Version 4.0.0 section in CHANGELOG.md
if [ -f "docs/CHANGELOG.md" ]; then
head -30 docs/CHANGELOG.md
fiRepository: typetools/checker-framework
Length of output: 855
🏁 Script executed:
# Search for Java/release version configuration across build.gradle files
rg "options\.release|sourceCompatibility|targetCompatibility|version\s*=" -B2 -A2 --type gradleRepository: typetools/checker-framework
Length of output: 2328
🏁 Script executed:
# Verify which Checker Framework artifacts are actually published/distributed
# Look for what gets published in the build configuration
rg "publishing|artifacts\s*{|jar\s*{" -A5 build.gradle | head -50Repository: typetools/checker-framework
Length of output: 209
🏁 Script executed:
# Check if checker-qual-android is explicitly mentioned in build.gradle
rg "checker-qual-android" build.gradle -B3 -A3Repository: typetools/checker-framework
Length of output: 834
Make the artifact compatibility break explicit and include the missing module.
This entry currently reads as though only the launcher moved to JDK 21 and the remaining jars still work on some unspecified "earlier" Java. In this PR, only checker-qual, checker-qual-android, and checker-util stay on Java 11 bytecode; the rest of the published artifacts now move to Java 21. The changelog omits checker-qual-android from the list and does not spell out that exception list, so downstream users may miss the actual breaking change.
Suggested wording
-To run the Checker Framework, you need to use a JDK 21 or later version of
-javac. The Checker Framework can run on any Java project, including projects
-that compile to Java 8, 11, or 17 bytecodes and run on JRE versions 8, 11, or
-17.
-
-The type qualifiers and utility libraries in `checker-qual.jar` and
-`checker-util.jar` still use Java 11 bytecode. Thus, they may be included in
-projects that run under an earlier version of Java.
+To run the Checker Framework, you need JDK 21 or later. The Checker Framework
+can still analyze source code that targets older Java releases, such as
+`--release 8`, `11`, or `17`.
+
+Most Checker Framework artifacts now use Java 21 bytecode. The exceptions are
+`checker-qual.jar`, `checker-qual-android.jar`, and `checker-util.jar`, which
+still use Java 11 bytecode.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| To run the Checker Framework, you need to use a JDK 21 or later version of | |
| javac. The Checker Framework can run on any Java project, including projects | |
| that compile to Java 8, 11, or 17 bytecodes and run on JRE versions 8, 11, or | |
| 17. | |
| The type qualifiers and utility libraries in `checker-qual.jar` and | |
| `checker-util.jar` still use Java 11 bytecode. Thus, they may be included in | |
| projects that run under an earlier version of Java. | |
| To run the Checker Framework, you need JDK 21 or later. The Checker Framework | |
| can still analyze source code that targets older Java releases, such as | |
| `--release 8`, `11`, or `17`. | |
| Most Checker Framework artifacts now use Java 21 bytecode. The exceptions are | |
| `checker-qual.jar`, `checker-qual-android.jar`, and `checker-util.jar`, which | |
| still use Java 11 bytecode. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/CHANGELOG.md` around lines 10 - 17, The changelog entry is unclear about
which artifacts remain on Java 11 and which moved to JDK 21; update the
paragraph to explicitly state that all published artifacts now target Java 21
except for checker-qual, checker-qual-android, and checker-util which remain on
Java 11 bytecode, and mention that downstream users may need JDK 21 to run the
launcher and other artifacts; reference the existing terms "JDK 21",
"checker-qual.jar", "checker-qual-android", and "checker-util.jar" (or their
artifact names) when clarifying compatibility and the breaking change so readers
can immediately see the exception list and required Java versions.
| \item \<-J--add-exports=...=ALL-UNNAMED> which exports the listed packages. This is | ||
| required with JDK 17+ because the Checker Framework accesses non-exported members of these packages. | ||
| (These are also required with JDK 11 if \<--illegal-access> is set to \<deny>.) | ||
| required because the Checker Framework accesses non-exported members of these packages. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Read the context around line 488 in the external-tools.tex file
head -500 docs/manual/external-tools.tex | tail -30Repository: typetools/checker-framework
Length of output: 1685
🏁 Script executed:
# Get a broader view of the section around line 488
sed -n '470,510p' docs/manual/external-tools.texRepository: typetools/checker-framework
Length of output: 2175
🌐 Web query:
Java module system --add-exports --add-opens difference
💡 Result:
In the Java Platform Module System (JPMS), --add-exports and --add-opens are command-line options used to circumvent strong encapsulation by allowing access to internal packages of modules. --add-exports <source-module>/<package>=<target-module> exports the specified package from the source module to the target module (or ALL-UNNAMED for classpath code). This makes all public types and their public members in that package accessible at both compile time (javac) and runtime (java). It enables normal code access (e.g., direct usage of public classes/interfaces) but does not allow access to non-public members. --add-opens <source-module>/<package>=<target-module> opens the specified package from the source module to the target module (or ALL-UNNAMED). This allows reflective access at runtime to all types and members (public, protected, package-private, and private) in that package via java.lang.reflect APIs, typically requiring setAccessible(true). It does not enable normal compile-time access to non-exported public types. Key differences: - Access type: --add-exports for public API access (compile + runtime); --add-opens for deep reflection (runtime only). - Visibility: --add-exports exposes only public elements; --add-opens exposes all elements via reflection. - Usage: Use --add-exports for libraries needing internal public classes; --add-opens for frameworks like Spring/Hibernate needing private field/method access via reflection. Example: java --add-exports java.base/sun.util.calendar=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar app.jar These options should be used cautiously as they break encapsulation and may lead to incompatibility if internals change. Prefer module-info.java exports/opens directives when possible. Available since Java 9, unchanged in Java 23.
Citations:
- 1: https://stackoverflow.com/questions/44056405/whats-the-difference-between-add-exports-and-add-opens-in-java-9
- 2: https://dev.java/learn/modules/add-exports-opens/
- 3: https://docs.oracle.com/en/java/javase/17/migrate/migrating-jdk-8-later-jdk-releases.html
- 4: https://docs.oracle.com/en/java/javase/23/docs/specs/man/java.html
- 5: https://openjdk.org/jeps/261
Correct the --add-exports description: clarify that it exposes public types, not non-public members.
Line 488 conflates two separate module-system mechanisms. The --add-exports option makes public types and their public members accessible from non-exported packages. Reflective access to non-public members—which is what "accesses non-exported members" suggests—is handled by the preceding --add-opens bullet, not --add-exports. The current wording is misleading.
Suggested wording
-\item \<-J--add-exports=...=ALL-UNNAMED> which exports the listed packages. This is
-required because the Checker Framework accesses non-exported members of these packages.
+\item \<-J--add-exports=...=ALL-UNNAMED> which exports the listed packages. This is
+required because the Checker Framework accesses types in packages that \<jdk.compiler>
+does not export by default.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| \item \<-J--add-exports=...=ALL-UNNAMED> which exports the listed packages. This is | |
| required with JDK 17+ because the Checker Framework accesses non-exported members of these packages. | |
| (These are also required with JDK 11 if \<--illegal-access> is set to \<deny>.) | |
| required because the Checker Framework accesses non-exported members of these packages. | |
| \item \<-J--add-exports=...=ALL-UNNAMED> which exports the listed packages. This is | |
| required because the Checker Framework accesses types in packages that \<jdk.compiler> | |
| does not export by default. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/manual/external-tools.tex` around lines 487 - 488, Update the docs entry
for the --add-exports bullet to state that it exposes public types and their
public members (not non-public members) to other modules; change the phrasing
around the \item \<-J--add-exports=...=ALL-UNNAMED> line so it clearly
distinguishes --add-exports (exposes public types/public members) from
--add-opens (permits reflective access to non-public members), and ensure the
example text refers to public API exposure rather than accessing non-exported
members.
|
@mernst The main constraint we have on Spring side is via NullAway that we have chosen as the default null-safety checker, and which is using checker-framework as a dependency. It is technically possible to use JDK 21 and generate Java 17 bytecode, but this kind of custom arrangement is pretty niche for our users and adds some complexity project maintainers usually don't want to manage, so for most projects if you are running an application on a Java 17 runtime on production, you will typically use the related JDK 17, so we would like to keep NullAway usable with JDK 17. Like Manu shared above, that is maybe not a blocker for you, but a concern I wanted to express as I would have preferred NullAway to be able to leverage checker-framework 4.x. If you move forward, I guess my ask for Manu will be to stay on checker-framework 3.x for the time being but I guess we can discuss that on NullAway side. Also I would have preferred checker-framework 4.x remains usable for all users of our latest generation (Spring Boot 4.x, Spring Framework 7.x) without additional complexity coming from this baseline change, but it remains your decision. @msridhar I see in the release notes that |
NullAway depends on Checker Framework's dataflow module, which in turn depends on the javacutil module. |
|
Closed in favor of #7567. |
|
@sdeleuze We will accommodate your request. (I just rewrote a bunch of Java 21 switch statements back into cascaded |
|
Much appreciated thanks, I will! |
No description provided.