google-java-format doesn't work in intellij idea,when i upgrad to jdk 21 with enable preview feature!~
My code use some preview feature, such as string template. the code likes below
throw new IllegalArgumentException(STR."place:\{placeOrg.getName()},\{yearMonth}");
the error message is below
google-java-format failed. Does SchedulingAutomateFacade.java have syntax errors?
I worked with IntelliJ IDEA 2023.2.2
Does anyone can help me to solve this problem? Thanks
Same for pattern matching
I mentioned a pattern matching failure here: https://github.com/google/google-java-format/issues/922#issuecomment-1732461668
When I read the title I tough you add the same issue that I have : https://youtrack.jetbrains.com/issue/IDEA-341425/JDK21-git-hook-Unrecognized-option-add-exports
I have the same issue with Intellij google-java-format plugin v1.20.0.0 . Is there a solution yet ?
The spotless maven plugin works fine using GJF v1.21.0
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
<configuration>
<java>
<includes>
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
</includes>
<importOrder />
<removeUnusedImports />
<googleJavaFormat>
<version>1.21.0</version>
<style>GOOGLE</style>
<reflowLongStrings>true</reflowLongStrings>
<formatJavadoc>false</formatJavadoc>
</googleJavaFormat>
</java>
</configuration>
<executions>
<execution>
<id>spotless-check</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>`
I am also facing the same issue.