spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Remove support for Java 11

Open nedtwigg opened this issue 1 year ago • 3 comments

Some of our formatters can't compile on Java 11 anymore, so supporting Java 11 at all is getting harder. We'll support it a while longer, but its days are numbered...

  • would make this issue trivial: https://github.com/diffplug/spotless/issues/1533

Running checklist of todo items to make this happen (please don't send PRs for these at this time, we aren't pulling the plug on Java 11 yet)

  • [ ] remove CDT build complexity added in aab831c
  • [ ] bump to latest JGit, which has worktree support
  • [ ] can remove JGit system config workaround in https://github.com/diffplug/spotless/commit/0c66cb027d4d190ae27676ed04afe0327c348c07
  • [ ] we'll need to bump minimum Gradle to 7.3, which lets us remove some compat stuff
    • https://github.com/diffplug/spotless/issues/2375#issuecomment-2574504289

nedtwigg avatar Jan 01 '25 19:01 nedtwigg

Not sure why, but on Java 11, JGit was causing this to happen.

- Class `org.eclipse.jgit.util.FS`: external process started '/usr/bin/git --version'
  See https://docs.gradle.org/8.4/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Class `org.eclipse.jgit.util.FS`: external process started '/usr/bin/git config --system --show-origin --list -z'
  See https://docs.gradle.org/8.4/userguide/configuration_cache.html#config_cache:requirements:external_processes

We don't have the problem on Java 17 or later. This hack fixes it

https://github.com/diffplug/spotless/pull/2376/commits/0c66cb027d4d190ae27676ed04afe0327c348c07

But it would probably be good to remove it when we bump the minimum Java from 11 to 17.

EDIT: after removing it, we get the error Java 17 only, but not 21 and 24. Hrm... I wonder if it is some kind of global build cache thing - first build to run hits the problem, subsequent works around thanks to reusing a result from the remote build cache...

nedtwigg avatar Jan 06 '25 20:01 nedtwigg

Another benefit to bumping to Java 17 is that we could use the latest JGit, which adds worktree support.

nedtwigg avatar Jan 07 '25 06:01 nedtwigg

It would also bump our required version of Gradle to 7.3, which would allow some minor simplifications here:

  • https://github.com/diffplug/spotless/blob/f22eda923e1a9d663f14b0db3f4918765023740c/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessPlugin.java#L30-L31
  • https://github.com/diffplug/spotless/blob/f22eda923e1a9d663f14b0db3f4918765023740c/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java#L46-L50

nedtwigg avatar Jan 07 '25 06:01 nedtwigg

With the pending release of Gradle 9, I think this is the right time for us to bump minimums, thanks to the linked PR by @Goooler above. If you need/want us to stay compatible with old stuff for a bit longer, speak up now!

nedtwigg avatar Jul 16 '25 20:07 nedtwigg

I don't.

Goooler avatar Jul 17 '25 01:07 Goooler

My plan is:

  • merge #2553 when it is ready
  • push a release, it will be the last supporting pre-17
  • merge #2375
  • then we can hopefully resolve all the checkboxes at the top of this issue

nedtwigg avatar Jul 18 '25 23:07 nedtwigg

Complete! Huge thanks @Goooler, you did the hard part!

nedtwigg avatar Jul 21 '25 20:07 nedtwigg

Published in plugin-gradle 8.0.0 and plugin-maven 3.0.0.

nedtwigg avatar Sep 24 '25 17:09 nedtwigg