Skip to content
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 parser does not support multiple closure arguments without parentheses #4772

Conversation

jevanlingen
Copy link
Contributor

What's changed?

Support for multiple closure arguments without parentheses.

What's your motivation?

If you have a piece of Gradle task like:

copySpec {
    from { 'src/main/webapp' } { exclude "**/*.jpg" }
    rename '(.+)-staging(.+)', '$1$2'
}

it won't work because the Groovy parser could not parse multiple closure arguments without parentheses.

Have you considered any alternatives or workarounds?

You can workaround the problem, by adding parentheses:

copySpec {
    from({ 'src/main/webapp' }, { exclude "**/*.jpg" })
    rename '(.+)-staging(.+)', '$1$2'
}

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@jevanlingen jevanlingen self-assigned this Dec 11, 2024
@jevanlingen jevanlingen added parser-groovy bug Something isn't working labels Dec 11, 2024
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see this fixed, thanks!

@timtebeek timtebeek merged commit a473f26 into main Dec 11, 2024
2 checks passed
@timtebeek timtebeek deleted the 4766-groovy-parser-does-not-support-multiple-closure-arguments-without-parentheses branch December 11, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-groovy
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Groovy parser does not support multiple closure arguments without parentheses
2 participants