Skip to content

GrEclipseFormatterStep can't run after JDK 11. #685

Description

@nedtwigg

As demonstrated by GrEclipseFormatterStepTest, on JRE 11, we get a warning like this:

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

And in JRE 14, we get a failure like this:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:39)
at org.codehaus.groovy.ast.ClassHelper.makeCached(ClassHelper.java:133)
at org.codehaus.groovy.ast.ClassHelper.<clinit>(ClassHelper.java:67)
at org.codehaus.groovy.classgen.Verifier.<clinit>(Verifier.java:113)
at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:158)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.makeCompilationUnit(GroovyParser.java:467)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.<init>(GroovyParser.java:247)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.<init>(GroovyParser.java:216)
at org.codehaus.groovy.eclipse.core.compiler.GroovySnippetParser.dietParse(GroovySnippetParser.java:105)
at org.codehaus.groovy.eclipse.core.compiler.GroovySnippetParser.parse(GroovySnippetParser.java:69)
at org.codehaus.groovy.eclipse.refactoring.core.utils.ASTTools.getASTNodeFromSource(ASTTools.java:204)
at org.codehaus.groovy.eclipse.refactoring.formatter.DefaultGroovyFormatter.initCodebase(DefaultGroovyFormatter.java:109)
at org.codehaus.groovy.eclipse.refactoring.formatter.DefaultGroovyFormatter.format(DefaultGroovyFormatter.java:121)
at com.diffplug.spotless.extra.eclipse.groovy.GrEclipseFormatterStepImpl.format(GrEclipseFormatterStepImpl.java:81)

To fix this, we now skip GrEclipseFormatterStepTest for all JRE after 11, as implemented in this commit: b101de2

This isn't urgent, but will probably become an issue someday. If you want to use Java 13 features and use google-java-format, then you have to run your build with Java 13 (same for 14, 15, etc.). As a result, if people want to use language features after Java 11, and google-java-format, then they can't also use GrEclipse to format their gradle build files anymore. One workaround is to use the eclipse formatter rather than google-java-format.

Activity

  1. nedtwigg commented on Sep 8, 2020

    @nedtwigg
    MemberAuthor

    From this thread, it looks like either Groovy 2.5.10 or 3.0 have the JDK 14 bugfix. Not sure how that relates to greclipse.

  2. self-assigned this
    on Sep 21, 2020
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions