sherter/google-java-format-gradle-plugin

Java Bytecode version error with JDK 8

vincenzopalazzo opened this issue · 6 comments

Hello, thank you to maintain this plugin.

I see an error with JDK 8, and I will report it below

Execution failed for task ':verifyGoogleJavaFormat'.
> com/google/googlejavaformat/java/JavaFormatterOptions$Style has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

With JDK 14 works well.

The later versions don't support Java 8, which is a problem because the Java 8 version isn't compatible with Gradle 7: #59

There is nothing I can do about this, the class in question is compiled by the https://github.com/google/google-java-format/ project.

But you could try to downgrade to an older version of google-java-format (by setting the toolVersion).

Um, no, can't. Because the older version uses a feature that's deprecated in Gradle 7.x.

It appears we are at an impasse. The team that writes Google Java Format saw fit to upgrade it to Java 11 before getting rid of the Gradle deprecations, which forces all of us on Java 8 to either never upgrade Gradle, or stop using GJF.

@jimshowalter It seems you have yet to understand what this gradle plugin does and how it relates to google-java-format. Please carefully read my comments and the documentation again (or rather first). google-java-format doesn't use Gradle at all.

If you follow the instructions in the readme in https://github.com/jimshowalter/gjf-problem, you'll reproduce the problem we're seeing. If you can figure out what combination of configuration will make Java 8 work with the formatter and with Gradle 7.x, that would be great!