openrewrite / rewrite-migrate-java

OpenRewrite recipes for migrating to newer versions of Java.
Apache License 2.0
102 stars 71 forks source link

Also change Guava Predicate method name #473

Closed timtebeek closed 5 months ago

timtebeek commented 5 months ago

What's changed?

Added an additional ChangeMethodName and unit test to PreferJavaUtilPredicate.

What's your motivation?

Fixes #435

Anything in particular you'd like reviewers to focus on?

ChangeMethodName for now ignores the NewClass, instead looking for ClassDeclaration when trying to match the method pattern supplied, which therefor mismatches and fails to do the required replacement. This should probably be fixed upstream in rewrite-java.

Have you considered any alternatives or workarounds?

We could add a dedicated recipe here for that replacement, but then any similar such change would need the same. It'd be easier if ChangeMethodName supported this out of the box, especially when using matchOverrides.

Any additional context

timtebeek commented 5 months ago

Requires