-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong formatting (missing whitespace) in Java instanceof type pattern with method calls on the left side #1046
Comments
I just played around with different versions, it seems that this issue is introduced in 5.15.1 due to the following update:
I was just able to update to the latest version of com.diffplug.spotless 6.0.5 when still using 4.19.0 for the Eclipse formatter. |
Seems like a bug in eclipse |
Thanks for the fast feedback, @nedtwigg |
I don't know if they are already aware, and if they aren't it would be a good idea to open an issue with them. If you find anything interesting at https://bugs.eclipse.org/bugs/ feel free to post it back here. Spotless integrates with lots of formatters. We don't take responsibility for their bugs, but we are happy to keep issues such as this open so that people can track/coordinate. |
Looks like this will get fixed when #1059 gets fixed. |
Has been fixed for a long time. |
If you are submitting a bug, please include the following:
gradlew spotless[Apply/Check] --stacktrace
We still use Spotless 5.15.0 because all subsequent releases introduce an issue that we are affected: a whitespace before
instanceof
is removed in some cases, not all.We use Gradle 7.3.3 and a custom Eclipse configuration: https://github.com/ls1intum/Artemis/blob/develop/artemis-spotless-style.xml (Note: In Eclipse, it seems the formatting works correctly for the example that went wrong in our repository)
Our full gradle file is here: https://github.com/ls1intum/Artemis/blob/develop/build.gradle
Here is the relevant spotless configuration:
When I update to the latest spotless version in line 24 of
build.gradle
id "com.diffplug.spotless" version "6.0.5"
then using
./gradlew spotlessApply -x webapp
will lead to changes that are wrong:0001-wrong-spotless-changes-git-patch.txt
Here is one simple example:
Notice the removed whitespace between the method call on the left side and
instanceof
.It seems that a method call on the left side of the Java instanceof type pattern is not handled correctly, because it works correctly if the left side is a normal variable.
I went through all Eclipse Code Style settings and could not find an appropriate setting for a whitespace between a method call and instanceof.
My OS version is macOS 12.1, but it seems this is independent of the OS
The text was updated successfully, but these errors were encountered: