Update 'google-java-format' 1.7 -> 1.9
zziga opened this issue · comments
What steps will reproduce the problem?
Steps to reproduce the behavior:
- mvn git-code-format:format-code; git add . ; git commit -m"Apply code format"
- mvn spotless:apply // to test reformat
What is the expected output?
No changes.
$ git status
> ... nothing to commit, working tree clean
What happens instead?
Code got reformatted.
$ git status
> ... modified: Foo.java
Environment:
- OS: macOS 11.0.1
- Git version: 2.28.0
- git-code-format-maven-plugin version: 2.7
- Maven version: 3.6.3
- Java version: 11
Here's plugins configuration:
<project>
<build>
<plugins>
...
<plugin>
<groupId>com.cosium.code</groupId>
<artifactId>git-code-format-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.6.0</version>
<configuration>
<java>
<googleJavaFormat/>
</java>
</configuration>
</plugin>
...
Link to a git repository that can be cloned to reproduce the problem:
Private repository, but if I'll manage to replicate it on a public repo, I'll add it in here.
Additional context
Being up to date with latest google-java-format version, saves clarifications when google-java-format IDE plugins or other formatting plugins 'change' formatting.
There is a formatting change around stram()
which changed in google-java-format 1.8.
// google-java-format 1.7
xxx xxx =
xxx.xxx().xxx().xxx()
.stream()
.xxx()
.xxx();
// google-java-format 1.8 and 1.9
xxx xxx =
xxx
.xxx()
.xxx()
.xxx()
.stream()
.xxx()
.xxx();
For a test, I've upgraded google-java-format version (https://github.com/Cosium/git-code-format-maven-plugin/blob/master/pom.xml#L43) to 1.8
and 1.9
and reformatted with snapshot build of git-code-format-maven-plugin and got same format as with the other plugin (spotless uses 1.9).
Note that google-java-format requires JDK 11 at runtime.