google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

google-java-format doesn't work in intellij idea,when i upgrad to jdk 21 with enable preview feature!~

Open coderhuang opened this issue 2 years ago • 5 comments

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

coderhuang avatar Sep 22 '23 02:09 coderhuang

Same for pattern matching

burl21 avatar Sep 22 '23 15:09 burl21

I mentioned a pattern matching failure here: https://github.com/google/google-java-format/issues/922#issuecomment-1732461668

duncanmak avatar Sep 24 '23 02:09 duncanmak

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

survivant avatar Dec 20 '23 01:12 survivant

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>`

aneeshpadmanabhan avatar Mar 14 '24 22:03 aneeshpadmanabhan

I am also facing the same issue.

false9striker avatar Apr 11 '24 19:04 false9striker