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
[Discussion] Increasing minimum supported JDK (and dropping support for JDK 11) #3803
Error Prone will eventually drop support for running on JDK 11. This bug is intended to collect input from the community on the timing of that decision. There aren't immediate plans to do this, but there are also reason to look forward to using Java > 11 language features in the implementation.
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 17 javac and pass --release 8 to compile Java 8 code that is deployed to a JDK 8 runtime.
Questions:
What would the next minimum supported version be? (I think a likely answer is 17, since it's the next LTS after 11.)
If you're currently running Error Prone on JDK 11, do you have a timeline for upgrading to a newer version?
Reacted by Rick Ossendrijver, Philipp Wendler, Sylwester Lachiewicz, Clayton Walker, Zac Sweers, Michael Vorburger, Pim van der Loos and Sergiy Morenets
Great topic. Some n=1 feedback: all Picnic-internal code targets JDK 17. For Error Prone Support we kept the baseline at JDK 11, but that does impede the use of text blocks in unit tests which is a shame, because they would be a great quality of life improvement i.c.w. CompilationTestHelper and BugCheckerRefactoringTestHelper (PicnicSupermarket/error-prone-support#198). (Given Error Prone's reliance on JDK internals we do want to run the tests against all supported JDKs, so testing only on JDK 15+ doesn't seem appropriate.)
Reacted by Liam Miller-Cushon and Rick Ossendrijver
Dropping JDK 11 in 2023 would be premature. Where I work, we have not migrated everything off of JDK 8 yet. Any place that has a large codebase to maintain, especially libraries that are still in use by JDK 8 / 11 applications, will have a long road ahead of them to get to 17.
Getting 95% of apps and libraries to 17 won't happen for us for 2+ years.
Reacted by Liam Miller-Cushon, Lázaro Clapp, Semyon Levin, Jeremy Norris and Santiago González
Thanks! That sort of input is why I opened the issue. When we eventually do start requiring JDK 17 to run Error Prone I don't want that to be too onerous. It'll still be possible to continue to use older versions of Error Prone to get compatibility with older JDK versions, but we also don't want to do that too soon and cause fragmentation.
One thing to note is that using JDK 17 to run javac during the build doesn't prevent building code that is deployed to JDK 8, the compiler just has to be configured with --release 8 (or -source/-target/-bootclasspath).
At Google we aren't using JDK 8 anymore, and are using the latest javac to build while still supporting deployments to JDK 11.
We use Java 11 extensively and would prefer support is retained until it is out of LTS (2026?).
@alexec do you know if using a newer javac version and passing --release 11 to target Java 11 would be an option for you (there's a note about that in #3803 (comment))? Or is that not something you're likely to do?
@cushon using --release doesn't prevent from using Java api of later versions. So, you also need to use --system. I wouldn't say it's convenient for Error Prone users
@cushon using --release doesn't prevent from using Java api of later versions. So, you also need to use --system. I wouldn't say it's convenient for Error Prone users
That is not accurate, --release configures the language level and APIs, passing just --release 11 is equivalent to passing -source 11 -target 11 --system <path to JDK 11>.
(There are some situations --release doesn't support, e.g. I think it still can't be used together with --add-exports=, so --system is necessary for compilations that rely on that.)
We have 1000s of applications on Java 11. It's not feasible to migrate them.
Understood, to be clear that is not what I was asking. It's possible to use a newer version of javac at compile-time and still use an older JDK version in production, javac has support for targeting old JDK versions. E.g.:
@cushon have you tried it yourself? I have, and in my case it didn't work without --system. Which is logical, as javac don't know the path of JDK 11. And it doesn't search it.
@remal I'm guessing that you're thinking of (e.g.) -source 8, which has exactly the problem you are describing. --release 8 was introduced largely because of that problem, as discussed in the Motivation section of JEP 247.
@cushon I think as a corner case one might not be 100% safe with --release if code uses JDK-internal APIs? See, e.g., the issues we ran into with Error Prone checkers and internal javac APIs changing in JDK 17 (#4026). Does --release catch these issues as well?
We are currently using latest errorprone version to check code that targets Java 5, 6, and 7 (don't ask why).
Java 5 code already requires some hacks (bumping --release to Java 6 as Java 5 is no longer supported by javac 11 (javac --help):
--release <release>
Compile for a specific VM version. Supported targets: 6, 7, 8, 9, 10, 11
Switching to javac 17 would drop support for Java 6:
--release <release>
Compile for the specified Java SE release. Supported releases: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
Switching to javac 21 would drop support for Java 7:
--release <release>
Compile for the specified Java SE release.
Supported releases:
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
So switching to Java 17 could be a bit painful for those that are still stuck at Java 6. In our case I think applying the same hack (compiling all Java 5 and 6 code a second time with --release 7 for errorprone) should do the trick.
We (Uber) have recently finished the migration of the build system from buck to bazel and some initial JDK 17 support is being rolled out. However, the mass migration will probably still take some time and likely won't finish before the end of this half.
What would the next minimum supported version be? (I think a likely answer is 17, since it's the next LTS after 11.)
We at Trino project (https://github.com/trinodb/trino) rely on error-prone for static code analysis.
Trino currently requires Java 22 for compilation. From that perspective support for new Java language syntax is more important than supporting older versions. (Obviously this is not the only perspective that matters.)
As a general update here, I'm expecting Error Prone will not support running on JDK 11 after September 2024.
(As before using Error Prone to compile code that is deployed to earlier versions will still be fully supported, it will just require using a newer JDK for compilation and setting --release or -source/-target/-bootclasspath.)
From that perspective support for new Java language syntax is more important than supporting older versions.
Thanks, that's something I expect to provide as well and is somewhat separate, we want Error Prone to be compatible with the latest available JDK versions and Java language features regardless of what the minimum supported JDK version is.
A related point about Java language syntax is that raising the minimum supported JDK removes support for some older Java language versions, -source 6 -target 6 was removed in JDK 12 and so Error Prone effectively won't support Java 6 language features if we raise the minimum supported JDK from 11 to 17. (And -source 7 -target 7 was removed in JDK 20, so that will eventually go away the next time the minimum supported JDK is raised.)
Reacted by Piotr Findeisen, Stephan Schroevers, Clayton Walker, Yuxin Wang, Sergiy Morenets and Rick Ossendrijver
Activity
Stephan202 commentedon Feb 28, 2023
Great topic. Some n=1 feedback: all Picnic-internal code targets JDK 17. For Error Prone Support we kept the baseline at JDK 11, but that does impede the use of text blocks in unit tests which is a shame, because they would be a great quality of life improvement i.c.w.
CompilationTestHelperandBugCheckerRefactoringTestHelper(PicnicSupermarket/error-prone-support#198). (Given Error Prone's reliance on JDK internals we do want to run the tests against all supported JDKs, so testing only on JDK 15+ doesn't seem appropriate.)RobertTheBlair commentedon Mar 1, 2023
Dropping JDK 11 in 2023 would be premature. Where I work, we have not migrated everything off of JDK 8 yet. Any place that has a large codebase to maintain, especially libraries that are still in use by JDK 8 / 11 applications, will have a long road ahead of them to get to 17.
Getting 95% of apps and libraries to 17 won't happen for us for 2+ years.
cushon commentedon Mar 1, 2023
Thanks! That sort of input is why I opened the issue. When we eventually do start requiring JDK 17 to run Error Prone I don't want that to be too onerous. It'll still be possible to continue to use older versions of Error Prone to get compatibility with older JDK versions, but we also don't want to do that too soon and cause fragmentation.
One thing to note is that using JDK 17 to run javac during the build doesn't prevent building code that is deployed to JDK 8, the compiler just has to be configured with
--release 8(or-source/-target/-bootclasspath).At Google we aren't using JDK 8 anymore, and are using the latest javac to build while still supporting deployments to JDK 11.
RobertTheBlair commentedon Mar 3, 2023
True about older versions. As long as it is a major version update to require min jdk 17, should be clear what to expect.
ksilz commentedon Mar 14, 2023
I think it's too early to drop support for Java 11. Even the upcoming version 3 of the Quarkus framework still has Java 11 as the baseline.
alexec commentedon Aug 15, 2023
We use Java 11 extensively and would prefer support is retained until it is out of LTS (2026?).
cushon commentedon Sep 14, 2023
@alexec do you know if using a newer javac version and passing
--release 11to target Java 11 would be an option for you (there's a note about that in #3803 (comment))? Or is that not something you're likely to do?remal commentedon Sep 14, 2023
@cushon using
--releasedoesn't prevent from using Java api of later versions. So, you also need to use--system. I wouldn't say it's convenient for Error Prone usersalexec commentedon Sep 14, 2023
We have 1000s of applications on Java 11. It's not feasible to migrate them.
cushon commentedon Sep 14, 2023
That is not accurate,
--releaseconfigures the language level and APIs, passing just--release 11is equivalent to passing-source 11 -target 11 --system <path to JDK 11>.(There are some situations
--releasedoesn't support, e.g. I think it still can't be used together with--add-exports=, so--systemis necessary for compilations that rely on that.)Understood, to be clear that is not what I was asking. It's possible to use a newer version of javac at compile-time and still use an older JDK version in production, javac has support for targeting old JDK versions. E.g.:
remal commentedon Sep 14, 2023
@cushon have you tried it yourself? I have, and in my case it didn't work without
--system. Which is logical, as javac don't know the path of JDK 11. And it doesn't search it.cpovirk commentedon Sep 14, 2023
@remal I'm guessing that you're thinking of (e.g.)
-source 8, which has exactly the problem you are describing.--release 8was introduced largely because of that problem, as discussed in the Motivation section of JEP 247.cushon commentedon Sep 14, 2023
Yes
Do you have an example of what didn't work?
It doesn't need a JDK 11, recent versions package data on the APIs for different JDK versions to allow cross-compilation.
Demo:
Compilation with
-source 8 -target 8succeeds, even though the compilation is using an API that isn't availableCompilation with
--release 8fails, because it also configures the corresponding API versionmsridhar commentedon Sep 14, 2023
@cushon I think as a corner case one might not be 100% safe with
--releaseif code uses JDK-internal APIs? See, e.g., the issues we ran into with Error Prone checkers and internal javac APIs changing in JDK 17 (#4026). Does--releasecatch these issues as well?9 remaining items
quijote commentedon Dec 16, 2023
We are currently using latest errorprone version to check code that targets Java 5, 6, and 7 (don't ask why).
Java 5 code already requires some hacks (bumping
--releaseto Java 6 as Java 5 is no longer supported by javac 11 (javac --help):Switching to javac 17 would drop support for Java 6:
Switching to javac 21 would drop support for Java 7:
So switching to Java 17 could be a bit painful for those that are still stuck at Java 6. In our case I think applying the same hack (compiling all Java 5 and 6 code a second time with
--release 7for errorprone) should do the trick.cushon commentedon Feb 15, 2024
Thank you to everyone who has provided feedback so far!
I reviewed some of the input provided on the timeline for this:
It looks like Quarkus 3.7 will use Java 17 as the minimum JDK: https://quarkus.io/blog/java-17/
@lazaroclapp are you able to provide any updates on that migration?
yuxincs commentedon Feb 16, 2024
@cushon
We (Uber) have recently finished the migration of the build system from buck to bazel and some initial JDK 17 support is being rolled out. However, the mass migration will probably still take some time and likely won't finish before the end of this half.
findepi commentedon May 10, 2024
We at Trino project (https://github.com/trinodb/trino) rely on error-prone for static code analysis.
Trino currently requires Java 22 for compilation. From that perspective support for new Java language syntax is more important than supporting older versions. (Obviously this is not the only perspective that matters.)
cushon commentedon May 25, 2024
As a general update here, I'm expecting Error Prone will not support running on JDK 11 after September 2024.
(As before using Error Prone to compile code that is deployed to earlier versions will still be fully supported, it will just require using a newer JDK for compilation and setting
--releaseor-source/-target/-bootclasspath.)Thanks, that's something I expect to provide as well and is somewhat separate, we want Error Prone to be compatible with the latest available JDK versions and Java language features regardless of what the minimum supported JDK version is.
A related point about Java language syntax is that raising the minimum supported JDK removes support for some older Java language versions,
-source 6 -target 6was removed in JDK 12 and so Error Prone effectively won't support Java 6 language features if we raise the minimum supported JDK from 11 to 17. (And-source 7 -target 7was removed in JDK 20, so that will eventually go away the next time the minimum supported JDK is raised.)cushon commentedon Sep 11, 2024
Error Prone 2.32.0 has been released, which raises the minimum supported JDK version to JDK 17: https://github.com/google/error-prone/releases/tag/v2.32.0
Bump JDK toolchain because ErrorProne dropped support for JDK 11
Bump JDK toolchain because ErrorProne dropped support for JDK 11
gemmellr commentedon Sep 12, 2024
Would be good to document the new requirement, i.e #4570
Use text blocks for internal Error Prone test outputs
Use text blocks for internal Error Prone test outputs
Run `:mockito-errorprone` tests on minimum version 17
Bump errorprone from 2.23.0 to 2.39.0 (#3674)