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

PreferJavaUtilFunction should not convert when used specifically as Guava type #436

Open
timo-abele opened this issue Mar 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@timo-abele
Copy link

timo-abele commented Mar 20, 2024

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

                <plugin>
                    <groupId>org.openrewrite.maven</groupId>
                    <artifactId>rewrite-maven-plugin</artifactId>
                    <version>5.23.1</version>
                    <configuration>
                        <activeRecipes>
                            <recipe>org.openrewrite.java.migrate.guava.NoGuavaJava11</recipe>
                        </activeRecipes>
                        <failOnDryRunResults>true</failOnDryRunResults>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.openrewrite.recipe</groupId>
                            <artifactId>rewrite-migrate-java</artifactId>
                            <version>2.10.0</version>
                        </dependency>
                    </dependencies>
                </plugin>

What is the Problem?

Example: in Collections2.transform(someList, com.google.common.base.Function) only the function is converted to a jdk equivalent. This breaks the build because transform only accepts a guava Function.

Are you interested in contributing a fix to OpenRewrite?

No, sorry

@timo-abele timo-abele added the bug Something isn't working label Mar 20, 2024
@timtebeek
Copy link
Contributor

Thanks for calling that out! We could indeed look to see if there's any surrounding method invocation that requires a Guava type, or even look how the type is used through https://github.com/openrewrite/rewrite-analysis/ to limit when we make changes.

@timtebeek timtebeek changed the title PreferJavaUtilFunction ignores the type expectations of context -> compile error PreferJavaUtilFunction should not convert when used specifically as Guava type May 5, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite May 5, 2024
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

2 participants