You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Increasing minimum supported JDK to JDK 21 (and dropping support for JDK 17) #4867
The minimum supported JDK to run Error Prone will eventually be updated from JDK 17 to JDK 21. This is tentatively planned for September 2025.
This bug is intended to collect input from the community. (Previously for the upgrade to JDK 17: #3803)
Note that using a newer JDK version to run javac during the build doesn't prevent building code that is deployed to earlier versions, the compiler just has to be configured with --release (or -source/-target/-bootclasspath). For example, it's supported to use the JDK 21 javac and pass --release 8 to compile Java 8 code that is deployed to a JDK 8 runtime.
If you're currently running Error Prone on JDK 17, do you have a timeline for upgrading to a newer version?
Reacted by Thomas Broyer, Stephan Schroevers, Artur Havliukovskyi, Manu Sridharan, ujjawal, Marc Philipp, Mikkel Kjeldsen, Vincent Potuček and David Phillips
Mockito uses ErrorProne. We don't update it as often as other dependencies, since it often requires manual resolution. As such, we are on 2.23.0. When we got around to resolving it manually, we realized that the minimum version is now JDK 17: mockito/mockito#3515
Given that Mockito is one of those projects that still supports older Java projects, we are currently on JDK 11. We do see that other popular projects move to JDK 17 (Spring, JUnit, AssertJ), whereas we usually take a more conservative approach. ByteBuddy (fundamental for Mockito) still supports Java 8.
We have discussed updating the baseline of Mockito to JDK 17. We updated our baseline last in Mockito 5 released in January 2023. Given that projects like Spring (https://spring.io/blog/2022/03/28/an-update-on-java-17-adoption), JUnit (junit-team/junit-framework#4246) and AssertJ (assertj/assertj#3442) all converge on Java 17, I think 17 for us the most likely candidate. If ErrorProne updates to 21, then we are left out to use ErrorProne for the next couple of years, which I consider quite a pity.
See also this question why not to choose 21 as the baseline for all of these projects.
@TimvdLippe do you think the part about "using a newer JDK version to run javac during the build doesn't prevent building code that is deployed to earlier versions, the compiler just has to be configured with --release" could apply to mockito? It looks like Mockito's CI is already using JDK 17 and then configuring Gradle to run tests on older versions:
Ah I had forgotten we did that (oops). In that case, it's not as bad as I initially thought it would. Still, I think as a JVM community we benefit from choosing 1 baseline version. For now, that appears to be JDK 17, so I rather have us all use JDK 17 as our baseline to build artifacts etc.
If ErrorProne ends up bumping, then yes in theory Mockito can update as well. Whether we will do so, I don't know yet, as I would like to discuss that with other open source maintainers first.
I'm going to make another release of Error Prone soon, and then will likely try updating the minimum supported version to JDK 21 for the next release after that.
Sorry to comment on this so late (I know this change has already been shipped), but I did not see this ask for community feedback before. This upgrade to a Java 21 baseline is not ideal from a Spring / Java server-side ecosystem POV. I mean Spring Framework 7 recommends using Java 25 but still uses Java 17 as a baseline, and the fact it has been done in a minor release is kind of surprising from a consumer POV. A lot of key building blocks of the server-side ecosystem still have a Java 17 baseline.
The strongest need for us to to have NullAway continuing to support Java 17+, so I think for now @msridhar tries to support/test both ErrorProne 2.42.0 (last release supporting Java 17) and the latest one, but how much time before it will become impossible?
@cushonLike CheckerFramework reconsidered a similar baseline upgrade, and given the fact that -XDaddTypeAnnotationsToSymbol=true is now also available on Java 17.0.19+, any chance the Java 17 compatibility could be restored in the ErrorProne 2.x line? Even a 17.0.19 baseline would be fine from our POV.
Activity
TimvdLippe commentedon Mar 14, 2025
Mockito uses ErrorProne. We don't update it as often as other dependencies, since it often requires manual resolution. As such, we are on 2.23.0. When we got around to resolving it manually, we realized that the minimum version is now JDK 17: mockito/mockito#3515
Given that Mockito is one of those projects that still supports older Java projects, we are currently on JDK 11. We do see that other popular projects move to JDK 17 (Spring, JUnit, AssertJ), whereas we usually take a more conservative approach. ByteBuddy (fundamental for Mockito) still supports Java 8.
We have discussed updating the baseline of Mockito to JDK 17. We updated our baseline last in Mockito 5 released in January 2023. Given that projects like Spring (https://spring.io/blog/2022/03/28/an-update-on-java-17-adoption), JUnit (junit-team/junit-framework#4246) and AssertJ (assertj/assertj#3442) all converge on Java 17, I think 17 for us the most likely candidate. If ErrorProne updates to 21, then we are left out to use ErrorProne for the next couple of years, which I consider quite a pity.
See also this question why not to choose 21 as the baseline for all of these projects.
cushon commentedon Mar 14, 2025
@TimvdLippe do you think the part about "using a newer JDK version to run javac during the build doesn't prevent building code that is deployed to earlier versions, the compiler just has to be configured with
--release" could apply to mockito? It looks like Mockito's CI is already using JDK 17 and then configuring Gradle to run tests on older versions:TimvdLippe commentedon Mar 15, 2025
Ah I had forgotten we did that (oops). In that case, it's not as bad as I initially thought it would. Still, I think as a JVM community we benefit from choosing 1 baseline version. For now, that appears to be JDK 17, so I rather have us all use JDK 17 as our baseline to build artifacts etc.
If ErrorProne ends up bumping, then yes in theory Mockito can update as well. Whether we will do so, I don't know yet, as I would like to discuss that with other open source maintainers first.
scordio commentedon Mar 16, 2025
@TimvdLippe FWIW, the Javadoc issues I fixed last year (mockito/mockito#3226 and mockito/mockito#3230) forced Mockito to use Java 21 at least when releasing.
In AssertJ, we decided to adopt the latest LTS to build the project, and we haven't encountered issues so far.
cushon commentedon Sep 17, 2025
I'm going to make another release of Error Prone soon, and then will likely try updating the minimum supported version to JDK 21 for the next release after that.
Enable Java 21 language features in Error Prone
Enable Java 21 language features in Error Prone
Enable Java 21 language features in Error Prone
Enable Java 21 language features in Error Prone
Delete `SourceVersion.supportsEffectivelyFinal`.
Delete `SourceVersion.supportsEffectivelyFinal`.
msridhar commentedon Oct 22, 2025
@cushon it may be good to add in the 2.43.0 release notes that Error Prone now requires JDK 21+.
remal commentedon Oct 22, 2025
Isn't it a breaking change? Shouldn't it be a new major version?
Projects that have Dependabot / Renovate will have a good time...
cushon commentedon Oct 22, 2025
Thanks, I added a note to https://github.com/google/error-prone/releases/tag/v2.43.0
remal commentedon Oct 22, 2025
Can we have a new major version?
ascopes commentedon Nov 8, 2025
Hi, it appears both the Wiki and the documentation for installation on the website still say Java 17 is supported.
I would fork to update those and raise a PR but I cannot find where they are defined in the repository.
cushon commentedon Nov 8, 2025
There's a PR to update the docs that I will get merged soon: #5308. I also updated the wiki, thanks.
Mention JDK 21 requirement in documentation
update errorprone to 2.46.0 (#27038)
chore: bump error-prone to 2.42.0, last version supporting Java 17
chore: bump error-prone to 2.42.0, last version supporting Java 17 (#159
Update ErrorProne from 2.42.0 to 2.49.0
Update ErrorProne from 2.42.0 to 2.49.0
sdeleuze commentedon Apr 27, 2026
Sorry to comment on this so late (I know this change has already been shipped), but I did not see this ask for community feedback before. This upgrade to a Java 21 baseline is not ideal from a Spring / Java server-side ecosystem POV. I mean Spring Framework 7 recommends using Java 25 but still uses Java 17 as a baseline, and the fact it has been done in a minor release is kind of surprising from a consumer POV. A lot of key building blocks of the server-side ecosystem still have a Java 17 baseline.
The strongest need for us to to have NullAway continuing to support Java 17+, so I think for now @msridhar tries to support/test both ErrorProne 2.42.0 (last release supporting Java 17) and the latest one, but how much time before it will become impossible?
@cushon Like CheckerFramework reconsidered a similar baseline upgrade, and given the fact that
-XDaddTypeAnnotationsToSymbol=trueis now also available on Java 17.0.19+, any chance the Java 17 compatibility could be restored in the ErrorProne 2.x line? Even a 17.0.19 baseline would be fine from our POV.Upgrade Error Prone to 2.49.0 and NullAway to 0.13.4