Repository navigation
Eclipse 4.17 (2020-09) will require Java 11 #547
Description
Activity
I don't see any urgency to adapt things on Spotless side. There will probably upcoming changes in the Eclipse plugins. But when this will affect a plugins used by Spotless is uncertain.
Most likely it will affect the framework bundles provided by
eclipse-basefirst, but sinceeclipse-basehas no immediate effect on the code formatting itself, but just on the environment, it might help to freezeeclipse-basedependency versions for a limited amount of time.Reacted by Ned TwiggI'm inclined to take the same approach here as we did in #687, specifically
spotless/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java
Lines 88 to 91 in 74d964d
/** On JRE 11+, returns `1.9`. On earlier JREs, returns `1.7`. */ public static String defaultVersion() { return JRE_VERSION >= 11 ? LATEST_VERSION_JRE_11 : LATEST_VERSION_JRE_8; } possibly coupled with
spotless/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java
Lines 220 to 233 in 74d964d
private static FormatterFunc suggestJre11(FormatterFunc in) { if (JRE_VERSION >= 11) { return in; } else { return unixIn -> { try { return in.apply(unixIn); } catch (Exception e) { throw new Exception("You are running Spotless on JRE " + JRE_VERSION + ", which limits you to google-java-format " + LATEST_VERSION_JRE_8 + "\n" + "If you upgrade your build JVM to 11+, then you can use google-java-format " + LATEST_VERSION_JRE_11 + ", which may have fixed this problem.", e); } }; } } Just released Goomph
3.25.0, which adds support for Eclipse 4.17 (2020-09). Themavencentralpart that we use is working, but the change to Java 11 presented some problems for me. Hopefully the Spotless stuff will just work, since @fvgh's framework allows us to skip most of the OSGi stuff.Funnily the classes for 2020.09 release obtained via M2 do not make any trouble using Java 8.
The classes obtained from P2 (for fat JARs) do causeUnsupportedClassVersionError.
So JDT core 3.23 (which provides support for Java 11, but I think also for 14) can be used with Java 8. Currently no problems have been found, but final tests are missing.Since for the fat JARs (WDT, CDT) the P2 part contains anyhow parts requiring Java 11, the corresponding projects should change their compiler/target version to Java 11.
For Groovy the evaluation is ongoing, whether a switch from P2 to M2 is possible.
Funnily the classes for 2020.09 release obtained via M2 do not make any trouble using Java 8.
Interesting! My experience running 2020.09 with Java 8 was vaguely similar. It did start, but it was definitely broken. Couldn't tell exactly which component broke, just that the IDE was not functional.
The docs for 4.17 still claim that Java 11 is required...
@nedtwigg As far as I saw from the P2 behaviour, the problem occurs at runtime, so whether one of the dependent JARs requires Java 11 is only visible as soon as the JAR is loaded. So it might be more conservative to use Java 11 on all new versions of the Eclipse extensions. Agreed?
@nedtwigg Sorry, had a second thought. Was so perplex about another issue I had with the fat JAR extensions.
So the doc states:A Java 11 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2020-09 packages based on Eclipse 4.17, as well as the Installer.
All
_extprojects have individual managed package dependencies which ape the once of a Eclipse release required by a formatter or the minimalistic framework (base).My goal with the
_exttests is the proper testing of all Eclipse interfaces used by the formatter. I think I at least use all external JARs. So if my tests do pass with Java 8, Java 11 is not required.Since I believe in my testing there is no need to be conservative. Java 11 should only be demanded if required. Otherwise
_extprojects should stick to the Spotless default Java version, which is currently 8.So if my tests do pass with Java 8, Java 11 is not required.
Sounds good to me!
Thanks to @fvgh, this has been fixed in
plugin-gradle 5.7.0andplugin-maven 2.5.0Hi every body, i have issue when I update spotless from version 5.15.0 to version 6.11.0, after that I got an error when I use this config in spotless config. My project is run with java 8.
my config:spotless { java { target project.fileTree(projectDir) { include "/**/*.java" } removeUnusedImports() eclipse('4.17.0').configFile("$rootDir/.codestyle/testspotless.xml") ... } }after I run spotless, I got an error when my project call function
removeUnusedImports()andeclipse('4.17.0').configFile("$rootDir/.codestyle/testspotless.xml"):Cannot change dependencies of dependency configuration ':spotless-209723591' after it has been resolved.
When I useeclipse version 4.16.0,the error is the same.Could you please help me solve this issue? if you know what ticket related to this issue, please guide me!
Thank you very much!@toanle2022 You might want to try to predeclare your deps.
https://www.eclipse.org/lists/cross-project-issues-dev/msg17532.html
Shouldn't be a big deal to support it, but we might have to think about keeping our default to whatever the last Java-8 supported version is. I'm hesitant to make our defaults require Java 11, though maybe the landscape will change in the next 6 months.