Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum required JRE to 11? #1337

Closed
nedtwigg opened this issue Sep 20, 2022 · 11 comments · Fixed by #1530
Closed

Bump minimum required JRE to 11? #1337

nedtwigg opened this issue Sep 20, 2022 · 11 comments · Fixed by #1530

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Sep 20, 2022

At some point within the next 20 years, it would make sense to bump our minimum JRE from 8 to 11. It might even make sense right now, though I'm in no hurry.

Things which are held back by our JRE 8 compatibility:

Things which are enabled by our JRE 8 compatibility

  • GJF pre-1.15.0
  • PalantirJavaFormat pre-2.10.0
  • Eclipse pre-4.21
  • Sortpom pre-3.2

Maybe other stuff. I don't think losing these older versions is catastrophic (and of course the old versions of Spotless don't go away either).

Please thumbs-up if you'd like a bump, thumbs-down if you don't.

@simonbasle
Copy link

I would prefer that change to be deferred a bit longer, as I'll still need to produce Java 8 artifacts for a few years.
Of course I should probably consider Gradle's toolchain feature in order to build Java 8 artifacts while running with a JDK 11+, but that's a migration I still need to evaluate and which will take time 😞

unless you would be able to continue delivering a Java 8 compatible Spotless in parallel to the Java 11 compatible version? If the only difference is the Java baseline + the JGit dependency + the features / changes that depend on JGit 6.x, perhaps this is achievable?

@nedtwigg
Copy link
Member Author

continue delivering a Java 8 compatible Spotless in parallel to the Java 11 compatible version

The old versions of Spotless won't go away, but they will not get new features or bugfixes. We will not have parallel development.

Most of the formatters we support already require Java 11 in their latest versions. So it is already the case that if you are stuck on Java 8, the formatters that Spotless delegates to are not getting new features or improvements.

@Emkas
Copy link
Contributor

Emkas commented Jan 10, 2023

Well, there always will be a legacy code and someone who doesn't want to go higher.

Even if I myself stay on a J8 for many reasons, I don't think this should be a reason to stay in place for any other software. I'd say that the more software will update to Java 11, the sooner our legacy code base will be updated to it.

@nedtwigg
Copy link
Member Author

Spotbugs gives bad warnings on Java 8. Because of that we only run it on Java 11, but we should redo this commit after we drop Java 8. 4aa3b7e

@nedtwigg
Copy link
Member Author

I think it's time to do this. I'm doing it in two steps.

  1. Keep running on Java 8, but yell at users to upgrade to 11 (and tell them how without affecting their end users) Bump minimum JRE to 11 (gracefully) #1514
  2. Once that has been released, actually upgrade to 11.

If you have submitted a lot of PRs to Spotless and this upgrade path is not okay with you, speak up soon and I can wait longer. But I'd like to do the upgrade gracefully (yell at users and tell them how to upgrade), and that means we need to do this early enough for the yelling release to be the latest available for a little while.

@nedtwigg
Copy link
Member Author

Part 1 published in plugin-gradle 6.14.0 and plugin-maven 2.31.0.

@eirnym
Copy link
Contributor

eirnym commented Jan 27, 2023

This is quite sad that you bump your plugin to java 11.

Additionally, while technically you can build a gradle plugin with Java 11, or even Java 17 bytecode, Gradle by default use Java 8 bytecode.

Additionally, many gradle plugins still support compatibility with Gradle 6.x (at least) and this can be built only with target Java8.

Now, to have Java 8 compiled, I have to write a plugin for my plugin to configure spotless plugin properly and my plugins section will look like below, which is a crappy, but I have to do this way.

plugins {
    id("com.gradle.plugin-publish") version "1.1.0" apply false
    if (JavaVersion.current() >= JavaVersion.VERSION_11) {
        id("com.diffplug.spotless") version "6.14.0"
    }
}

Why do I build using Java 8? I have integration tests running on each build, and they involve execution of Gradle tasks from version 6.0 to the current one. Using Java 11 I can't run any gradle below certain point.

I understand you won't revert your change, just informing you how this change affects many gradle plugins which use spotless for a quality control.

@nedtwigg
Copy link
Member Author

Sorry for the adverse effect, and thanks for communicating it :) Spotless 6.13.0 is still available, and most of the formatters we wrap don't support Java 8 anymore anyway, so if you're stuck on Java 8, there won't be much difference between 6.13.0 and future versions of Spotless anymore.

integration tests running on each build [that need Java 8]

One way to solve this is to run your build on Java 11, and use Java 8 as the runner for your integration tests.

https://docs.gradle.org/current/userguide/toolchains.html#specify_custom_toolchains_for_individual_tasks

Bumping to 11 here is an easy choice because of JGit. Spotless was over a year behind, and other plugins that use JGit (e.g. org.ajoberstar.grgit) have upgraded to JGit 6 to get the performance improvements and new features that JGit has shipped. It is currently impossible to use Spotless in the same build as those plugins.

6.13.0 is a great Spotless, nothing wrong with continuing to use it for a long time :)

@eirnym
Copy link
Contributor

eirnym commented Jan 27, 2023

My matrix include Java 8, 11, 17 and 19, so it's not as easy as "freeze spotless plugin"

@eirnym
Copy link
Contributor

eirnym commented Jan 28, 2023

It's quite easy to support dependencies which require java 11, 17 and so on as long as Gradle has still the same or almost the same API.

I've done in my plugin using following trick:

  • I build with Java 8 and 11 (to test gradle 6.0-current)
  • I build with java 17 release version

for a dependencyies which requires java 11 (currently it's AGP 7) and java 17 (upcoming AGP 8), I have a conditional inclusion in settings.gradle.kts and build.gradle.kts. Thus I have java 8 byte code, which uses proper API from AGP 7. nothing is breaking as long as my plugin is used as intended.

In your case for tests for google java formatter, it's easy to include even tests, adding a condition, that they'll run on java with number at least 11 or 17 (or whatever you need).

@eirnym
Copy link
Contributor

eirnym commented Jan 28, 2023

PS: I don't know how you handle dependencies for Maven as I don't use it. I know that Gradle plugin will work flawlessly

benkard added a commit to benkard/mulkcms2 that referenced this issue Apr 2, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.diffplug.spotless:spotless-maven-plugin](https://github.com/diffplug/spotless) | build | minor | `2.32.0` -> `2.33.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | patch | `2.16.1.Final` -> `2.16.2.Final` |
| [io.quarkus:quarkus-universe-bom](https://github.com/quarkusio/quarkus-platform) | import | patch | `2.16.1.Final` -> `2.16.2.Final` |

---

### Release Notes

<details>
<summary>diffplug/spotless</summary>

### [`v2.33.0`](https://github.com/diffplug/spotless/blob/HEAD/CHANGES.md#&#8203;2330---2023-01-26)

##### Added

-   `ProcessRunner` has added some convenience methods so it can be used for maven testing. ([#&#8203;1496](diffplug/spotless#1496))
-   `ProcessRunner` allows to limit captured output to a certain number of bytes. ([#&#8203;1511](diffplug/spotless#1511))
-   `ProcessRunner` is now capable of handling long-running tasks where waiting for exit is delegated to the caller. ([#&#8203;1511](diffplug/spotless#1511))
-   Allow to specify node executable for node-based formatters using `nodeExecutable` parameter ([#&#8203;1500](diffplug/spotless#1500))

##### Fixed

-   The default list of type annotations used by `formatAnnotations` has had 8 more annotations from the Checker Framework added [#&#8203;1494](diffplug/spotless#1494)

##### Changes

-   **POTENTIALLY BREAKING** Bump minimum JRE from 8 to 11, next release likely to bump bytecode to Java 11 ([#&#8203;1514](diffplug/spotless#1514) part 1 of [#&#8203;1337](diffplug/spotless#1337))
-   Rename `YamlJacksonStep` into `JacksonYamlStep` while normalizing Jackson usage ([#&#8203;1492](diffplug/spotless#1492))
-   Convert `gson` integration to use a compile-only source set ([#&#8203;1510](diffplug/spotless#1510)).
-   \*\* POTENTIALLY BREAKING\*\* Removed support for KtLint 0.3x and 0.45.2 ([#&#8203;1475](diffplug/spotless#1475))
    -   `KtLint` does not maintain a stable API - before this MR, we supported every breaking change in the API since 2019.
    -   From now on, we will support no more than 2 breaking changes at a time.
-   NpmFormatterStepStateBase delays `npm install` call until the formatter is first used. This enables better integration
    with `gradle-node-plugin`. ([#&#8203;1522](diffplug/spotless#1522))
-   Bump default `ktlint` version to latest `0.48.1` -> `0.48.2` ([#&#8203;1529](diffplug/spotless#1529))
-   Bump default `scalafmt` version to latest `3.6.1` -> `3.7.1` ([#&#8203;1529](diffplug/spotless#1529))

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v2.16.2.Final`](https://github.com/quarkusio/quarkus/releases/tag/2.16.2.Final)

[Compare Source](quarkusio/quarkus@2.16.1.Final...2.16.2.Final)

##### Complete changelog

-   [#&#8203;30976](quarkusio/quarkus#30976) - Metrics - check if index contains class before attempting to use it
-   [#&#8203;30965](quarkusio/quarkus#30965) - JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype is not null safe
-   [#&#8203;30959](quarkusio/quarkus#30959) - Return text from /q/metrics when the Accept header contains html
-   [#&#8203;30953](quarkusio/quarkus#30953) - Fix OIDC capability string
-   [#&#8203;30947](quarkusio/quarkus#30947) - Ignore interface/class without default constructs fields in SB config
-   [#&#8203;30940](quarkusio/quarkus#30940) - Use SchemaType.ARRAY instead of "ARRAY" for native support
-   [#&#8203;30919](quarkusio/quarkus#30919) - Compilation to native fails, when quarkus-smallrye-openapi is included
-   [#&#8203;30916](quarkusio/quarkus#30916) - Add AppCDS documentation
-   [#&#8203;30896](quarkusio/quarkus#30896) - Quarkus spring-boot-properties extension unable to handle complex configuration.
-   [#&#8203;30878](quarkusio/quarkus#30878) - Bump postgresql from 42.5.2 to 42.5.3
-   [#&#8203;30866](quarkusio/quarkus#30866) - Only run the quickstart compilation for main
-   [#&#8203;30851](quarkusio/quarkus#30851) - Fixed return type typo in smallrye graphQL guide
-   [#&#8203;30844](quarkusio/quarkus#30844) - Fixed greeting in getting started guide
-   [#&#8203;30839](quarkusio/quarkus#30839) - Fix handling of Accept header in graphQL
-   [#&#8203;30833](quarkusio/quarkus#30833) - Update docs to show BuildProducer use as method parameter instead of field
-   [#&#8203;30828](quarkusio/quarkus#30828) - Make OIDC session cookie same site lax by default
-   [#&#8203;30826](quarkusio/quarkus#30826) - Caffeine - Automatically register metrics cache impls if Micrometer is around
-   [#&#8203;30825](quarkusio/quarkus#30825) - Fix comment about Caffeine optimization
-   [#&#8203;30823](quarkusio/quarkus#30823) - Change accept header to valid plain text in micrometer documentation
-   [#&#8203;30821](quarkusio/quarkus#30821) - Packaging type -Dquarkus.package.create-appcds=true isn't documented
-   [#&#8203;30815](quarkusio/quarkus#30815) - Update SmallRye Config to 2.13.2
-   [#&#8203;30812](quarkusio/quarkus#30812) - Manage the apache-mime4j dependency
-   [#&#8203;30806](quarkusio/quarkus#30806) - */* in Accept header is ignored if not listed as the first item
-   [#&#8203;30805](quarkusio/quarkus#30805) - MailTemplateInstance with attachments
-   [#&#8203;30803](quarkusio/quarkus#30803) - Support file and byte array attachments in `MailTemplateInstance`
-   [#&#8203;30797](quarkusio/quarkus#30797) - OIDC login not work
-   [#&#8203;30783](quarkusio/quarkus#30783) - <artifactId> uses 'quarkus.platform.artifact-id' property
-   [#&#8203;30778](quarkusio/quarkus#30778) - Avoid creating 3 Liquibase MongoDB instances for startup operations
-   [#&#8203;30776](quarkusio/quarkus#30776) - Ensure that AwsProxyRequestContext can be used with [@&#8203;Context](https://github.com/Context) in RESTEasy Reactive
-   [#&#8203;30767](quarkusio/quarkus#30767) - Remove duplicate notification of SseBroadcaster's onErrorListeners
-   [#&#8203;30765](quarkusio/quarkus#30765) - Bump postgresql from 42.5.1 to 42.5.2
-   [#&#8203;30755](quarkusio/quarkus#30755) - Update ForwardedParser to validate the port
-   [#&#8203;30744](quarkusio/quarkus#30744) - \[Quarkus Native] ClassNotFoundException: com.github.benmanes.caffeine.cache.SSSW
-   [#&#8203;30536](quarkusio/quarkus#30536) - munitnyucontextmanager non helpful error reporting
-   [#&#8203;29753](quarkusio/quarkus#29753) - Introduce ConnectionFactoryWrapperBuildItem
-   [#&#8203;29605](quarkusio/quarkus#29605) - Update docs to reflect that injection should not
-   [#&#8203;27774](quarkusio/quarkus#27774) - PLANNER-1709 Avoid deprecated penalize/reward overloads
-   [#&#8203;23442](quarkusio/quarkus#23442) - problem using quarkus-resteasy-reactive-kotlin-serialization with AwsProxyRequestContext

</details>

<details>
<summary>quarkusio/quarkus-platform</summary>

### [`v2.16.2.Final`](quarkusio/quarkus-platform@2.16.1.Final...2.16.2.Final)

[Compare Source](quarkusio/quarkus-platform@2.16.1.Final...2.16.2.Final)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
jahrim added a commit to ldss-project/hexarc that referenced this issue Jun 22, 2023
Later versions of spotless do not support Java 8 anymore. Refer to:
diffplug/spotless#1337 (comment)
jahrim added a commit to ldss-project/hexarc that referenced this issue Jun 22, 2023
Later versions of spotless do not support Java 8 anymore. Refer to:
diffplug/spotless#1337 (comment)
jahrim added a commit to ldss-project/hexarc that referenced this issue Jun 22, 2023
Later versions of spotless do not support Java 8 anymore. Refer to:
diffplug/spotless#1337 (comment)
tueda added a commit to tueda/donuts that referenced this issue Dec 27, 2023
Note: for now, we do not upgrade spotless to 6.14.0 or later because of
diffplug/spotless#1337 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants