-
Notifications
You must be signed in to change notification settings - Fork 461
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
Groovy's "apply" adds semicolons #237
Comments
@boris-petrov What was the reason to close the issue? Just a quick guess on the subject: But you are right, semicolons should only be used in groovy where necessary. |
@fvgh - I added another edit to my original post in which I explain why I closed the issue, sorry. I did try adding a call to
And I was about to try to figure it out myself before writing here again. :) |
Ok, the trace is not very helpful. Coincidentally I just opened #236 yesterday. |
I'll try to create a reproduction, I think I'll be able to. I'll comment in the next few days. |
@fvgh - actually here's some code that triggers that exception for me: package com.company.util
class SomeClass {
Map<String, Object> foo(String a, String b, String c, String d,
Map<String, ? extends Object> e) {
}
} Tell me if it doesn't do that for you. P.S. the config is simple enough: ...
groovy {
target 'src/**/*.groovy'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
greclipse()
} |
Yes, it does. |
The current grEclipse version (better to say the underlying groovy-eclipse) has problems with bounded wildcards. It raises an exception when trying to create the AST. |
@boris-petrov
Can you have a look? For Spotless I provided with #244 a possibility to ignore compiler problems, but this of course can lead to incorrect formatting. |
@fvgh - sorry for the delayed answer. I'm not sure where to check the Eclipse logs but yes, whenever I try formatting a file which contains the code above, it doesn't do anything. If I remove that code, it formats it. So I guess it is the same problem. Do you have any ideas how to workaround that? Perhaps that PR is a good start. |
Work around for bounded wild-cardsThe PR will basically only skip the file processing. I made some major refactoring on how Spotless integrates Eclipse plugins and I am afraid I still need some more time. But you have the same effect, by just excluding the file manually. You can use the Gradle [file tree](https://docs.gradle.org/current/userguide/working_with_files.html#sec:file_trees) and use it as Spotless target. Untested example: groovyGradle {
target fileTree(rootDir) {
include '**/*.groovy'
exclude '**/file_with_bounded_wildcards.groovy'
}
} Solution for bounded wild-cardsThe plugin error message should be in "eclipse-workspace"/.metatdata/.log. I would appreciate if you can report the issue (with the Eclipse logs) to the [groovy-eclipse](https://github.com/groovy/groovy-eclipse) team. For a long period there was not much progress on the project, but it seems that they have for a couple of month now a team back together which is continuing the development. Please let me know as soon as a **groovy-eclipse** release is available which solves problem. I will integrated it to Spotless. I leave this issue open as a reminder to enhance `importOrder`for Groovy. |
@fvgh - groovy-eclipse has a |
plugin-maven does not have a Groovy extension. #237 is transparent for the plugin-maven users.
I have a custom
importOrder
forgroovy
and when I do agradle spotlessApply
it fixes that but it also adds semicolons to all import statements which it should not do.P.S. I see now that actually this could be configured using Eclipse's Groovy plugin - however I don't see how to export Grvooy's formatter settings - rather, I see only how to do so for Java's.
P.S. 2 - I found some link with an example file so I'll be closing this issue. The link to
greclipse.properties
in the README is broken, you might want to fix that.The text was updated successfully, but these errors were encountered: