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

GroovyParser should not report a warning when setting a writable property #4908

Open
bmuschko opened this issue Jan 15, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@bmuschko
Copy link
Contributor

bmuschko commented Jan 15, 2025

What version of OpenRewrite are you using?

  • OpenRewrite v8.43.1

How are you running OpenRewrite?

As a test that implements RecipeTest executed by Gradle. I also added a logging library to my test execution classpath.

testRuntimeOnly("org.slf4j:slf4j-simple:2.0.16")

What is the smallest, simplest way to reproduce the problem?

Write a custom recipe that generate a Gradle build file, along the lines of the following:

private SourceFile generateBuildFile(ExecutionContext ctx) {
     String buildFileContent = """
          plugins {
              id 'java'
          }
                
          version = '1.2.3'
    """;

    return GradleParser.builder().build()
               .parseInputs(singletonList(Parser.Input.fromString(Paths.get("build.gradle"), buildFileContent)), null, ctx)
               .findFirst().get();
}

What did you expect to see?

No warning from the Groovy parser. The property Project.version has a setter method.

What did you see instead?

The following output when executing the test with Gradle.

[Test worker] WARN org.openrewrite.groovy.GroovyParser - doesntmatter: 5: [Static type checking] - Cannot set read-only property: version
 @ line 5, column 1.
   version = '1.2.3'
   ^

1 error
@bmuschko bmuschko added the bug Something isn't working label Jan 15, 2025
@bmuschko bmuschko changed the title GroovyParser reports a warning when setting a writable property. GroovyParser should not report a warning when setting a writable property Jan 15, 2025
@timtebeek timtebeek moved this to Backlog in OpenRewrite Jan 15, 2025
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

1 participant