Skip to content

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

Description

@nedtwigg

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.

Activity

  1. fvgh commented on Mar 26, 2020

    @fvgh
    Member

    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.

  2. nedtwigg commented on Sep 8, 2020

    @nedtwigg
    MemberAuthor

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

  3. nedtwigg commented on Sep 17, 2020

    @nedtwigg
    MemberAuthor

    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.

  4. self-assigned this
    on Sep 21, 2020
  5. fvgh commented on Sep 24, 2020

    @fvgh
    Member

    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.

  6. nedtwigg commented on Sep 24, 2020

    @nedtwigg
    MemberAuthor

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

  7. fvgh commented on Sep 24, 2020

    @fvgh
    Member

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

  8. fvgh commented on Sep 24, 2020

    @fvgh
    Member

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

  9. nedtwigg commented on Sep 24, 2020

    @nedtwigg
    MemberAuthor

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

    Sounds good to me!

  10. nedtwigg commented on Oct 20, 2020

    @nedtwigg
    MemberAuthor

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

  11. toanle2022 commented on Oct 17, 2022

    @toanle2022

    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!

  12. nedtwigg commented on Oct 19, 2022

    @nedtwigg
    MemberAuthor

    @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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions