Open matsev opened 10 months ago
Can you manage to compile and try https://github.com/palantir/palantir-java-format/pull/935?
I have checked out PR #935 locally and I manage to build it if I use JDK 17 when running Cradle.
./gradlew -v
------------------------------------------------------------
Gradle 7.6.2
------------------------------------------------------------
Build time: 2023-06-30 15:42:51 UTC
Revision: dab132169006b16e7ada4ab2456e0c9d6415b52a
Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.8 (Amazon.com Inc. 17.0.8+7-LTS)
OS: Mac OS X 13.6.1 x86_64
./gradlew build
[...]
BUILD SUCCESSFUL in 29s
93 actionable tasks: 56 executed, 25 from cache, 12 up-to-date
However, that PR fails when tried to build using JDK 21 as it is not supported for running Gradle according to its compatibility matrix:
./gradlew -v
------------------------------------------------------------
Gradle 7.6.2
------------------------------------------------------------
Build time: 2023-06-30 15:42:51 UTC
Revision: dab132169006b16e7ada4ab2456e0c9d6415b52a
Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 21 (Amazon.com Inc. 21+35-LTS)
OS: Mac OS X 13.6.1 x86_64
./gradlew build
[...]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gradle-palantir-java-format:compileGroovy'.
> Unrecoverable compilation error: startup failed:
General error during conversion: Unsupported class file major version 65
Bump:
Java 21 is now supported from Gradle ~8.4 @matsev
@mandrean Thanks for the notification. I made an attempt to upgrade the Gradle wrapper to use Gradle ver 8.5, but there is some more work required to make this work, please see #977 for details
Any progress on this? We're starting to use more JDK21 features and this is preventing us to use when
.
:+1: urgent and necessary
Any update on this, we have moved to java 21 and using the new switch case features seem impossible without this change
Do you happen to have any updates on this issue? Is there anything specific holding it up that we can do to help resolve this?
Java 23 is just around the corner now, and I fear the lack of support for some of these newer constructs will become more and more of a problem for adoption (of both palantir-java-format
and modern java itself).
Java 21 / JEP 441 : Pattern Matching for switch code result in
com.palantir.javaformat.java.FormatterException
What happened?
This method compiles using JDK 21:
However, when using the
spotless-maven-plugin
together with<palantirJavaFormat>
results in an exception:Maven config:
Maven:
What did you want to happen?
The
maven-spotless-plugin
andplanter-java-format
should accept or reformat code that is supported by JDK 21