Skip to content

GrEclipseFormatterStep can't run after JDK 11. #685

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

Closed
nedtwigg opened this issue Sep 8, 2020 · 2 comments
Closed

GrEclipseFormatterStep can't run after JDK 11. #685

nedtwigg opened this issue Sep 8, 2020 · 2 comments
Assignees
Labels

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Sep 8, 2020

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.

@nedtwigg nedtwigg added the bug label Sep 8, 2020
@nedtwigg
Copy link
Member Author

nedtwigg commented Sep 8, 2020

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.

@nedtwigg
Copy link
Member Author

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants