Skip to content

Increasing minimum supported JDK to JDK 21 (and dropping support for JDK 17) #4867

Closed

Description

@cushon

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?

Activity

  1. pinned this issue on Mar 4, 2025
  2. TimvdLippe commented on Mar 14, 2025

    @TimvdLippe
    Contributor

    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.

  3. cushon commented on Mar 14, 2025

    @cushon
    CollaboratorAuthor

    @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:

  4. TimvdLippe commented on Mar 15, 2025

    @TimvdLippe
    Contributor

    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.

  5. scordio commented on Mar 16, 2025

    @scordio

    @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.

  6. cushon commented on Sep 17, 2025

    @cushon
    CollaboratorAuthor

    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.

  7. unpinned this issue on Oct 6, 2025
  8. pinned this issue on Oct 6, 2025
  9. msridhar commented on Oct 22, 2025

    @msridhar
    Contributor

    @cushon it may be good to add in the 2.43.0 release notes that Error Prone now requires JDK 21+.

  10. remal commented on Oct 22, 2025

    @remal

    Isn't it a breaking change? Shouldn't it be a new major version?

    Projects that have Dependabot / Renovate will have a good time...

  11. cushon commented on Oct 22, 2025

    @cushon
    CollaboratorAuthor

    @cushon it may be good to add in the 2.43.0 release notes that Error Prone now requires JDK 21+.

    Thanks, I added a note to https://github.com/google/error-prone/releases/tag/v2.43.0

  12. remal commented on Oct 22, 2025

    @remal

    Can we have a new major version?

  13. ascopes commented on Nov 8, 2025

    @ascopes

    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.

  14. cushon commented on Nov 8, 2025

    @cushon
    CollaboratorAuthor

    Hi, it appears both the Wiki and the documentation for installation on the website still say Java 17 is supported.

    There's a PR to update the docs that I will get merged soon: #5308. I also updated the wiki, thanks.

  15. sdeleuze commented on Apr 27, 2026

    @sdeleuze

    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=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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions