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

Eclipse 4.17 (2020-09) will require Java 11 #547

Closed
nedtwigg opened this issue Mar 26, 2020 · 11 comments · Fixed by #722
Closed

Eclipse 4.17 (2020-09) will require Java 11 #547

nedtwigg opened this issue Mar 26, 2020 · 11 comments · Fixed by #722
Assignees

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Mar 26, 2020

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.

@fvgh
Copy link
Member

fvgh commented Mar 26, 2020

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-base first, but since eclipse-base has no immediate effect on the code formatting itself, but just on the environment, it might help to freeze eclipse-base dependency versions for a limited amount of time.

@nedtwigg
Copy link
Member Author

nedtwigg commented Sep 8, 2020

I'm inclined to take the same approach here as we did in #687, specifically

/** 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

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);
}
};
}
}

@nedtwigg
Copy link
Member Author

Just released Goomph 3.25.0, which adds support for Eclipse 4.17 (2020-09). The mavencentral part 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.

@fvgh fvgh self-assigned this Sep 21, 2020
@fvgh
Copy link
Member

fvgh commented Sep 24, 2020

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 cause UnsupportedClassVersionError.
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.

@nedtwigg
Copy link
Member Author

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

@fvgh
Copy link
Member

fvgh commented Sep 24, 2020

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

@fvgh
Copy link
Member

fvgh commented Sep 24, 2020

@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 _ext projects 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 _ext tests 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 _ext projects should stick to the Spotless default Java version, which is currently 8.

@nedtwigg
Copy link
Member Author

So if my tests do pass with Java 8, Java 11 is not required.

Sounds good to me!

@nedtwigg
Copy link
Member Author

Thanks to @fvgh, this has been fixed in plugin-gradle 5.7.0 and plugin-maven 2.5.0

@toanle2022
Copy link

toanle2022 commented Oct 17, 2022

Hi 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() and eclipse('4.17.0').configFile("$rootDir/.codestyle/testspotless.xml"): Cannot change dependencies of dependency configuration ':spotless-209723591' after it has been resolved.
When I use eclipse 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!

@nedtwigg
Copy link
Member Author

@toanle2022 You might want to try to predeclare your deps.

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.

3 participants