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 files still are corrupted by open rewrite for well over a year now. #4531

Open
hazendaz opened this issue Sep 28, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@hazendaz
Copy link

I had previously opened tickets on this first with Jenkinsfile where its removing spacing by open rewrite. Every single version still continues to remove spaces when writting something like this

int value = something as int

The 'somethingasint' is the result making it useless for working with groovy. What ever came of fixing this as I see tickets claiming groovy was fixed but I've never seen it fixed at all. We alrady had to globally ignore Jenkinsfile. But any vars / groovy classes have the same issue.

@hazendaz hazendaz added the bug Something isn't working label Sep 28, 2024
@shanman190
Copy link
Contributor

Hi @hazendaz,

Historically speaking, the fix was to fully and completely disabled recipes and the auto format system. A while later a new way to control auto formatting (ie. AutoFormatService) was introduced allowing each language binding to provide their specific implementations for how styling should behave for the specific language. At that time, the Groovy language binding reintroduced auto formatting being very specific about what to actually format and what to avoid as known problematic.

Things have been pretty quiet on the formatting front since the introduction of that new system, but it sounds like the as type cast may be causing you some problems.

As we ask in the bug report issue type, would you mind confirming that the behavior is present in the latest release as well as how you are executing and with what versions you're executing the OpenRewrite recipes using? Including the specific recipe that you're executing as well when you are observing the issue would also be of great help.

@knutwannheden
Copy link
Contributor

I indeed also think this was fixed quite a while ago in release 8.11.1 as part of #3792. If you still see Groovy type casts getting mangled this way, it is possible that you are still using an old release of OpenRewrite.

@mccartney
Copy link
Contributor

FWIW, I've just tried the following test:

    @Test
    void groovyStyleCastForInt() {
        rewriteRun(
          groovy(
            """
               int value = 3 as int
              """
          )
        );
    }

and it passes in the current main (7d70216)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

4 participants