openrewrite / rewrite-migrate-java

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

Replace `Reference.clone()` with new constructor in Java 11 migration #510

Closed ranuradh closed 4 months ago

ranuradh commented 4 months ago

What's changed?

This PR contains recipe: org.openrewrite.java.migrate.ReferenceCloneMethod This rule: image

What's your motivation?

The custom recipe, replaces the calls to java.lang.ref.Reference.clone() with a constructor call passing in the referent and reference queue as parameters.

Anyone you would like to review specifically?

@timtebeek @cjobinabo

Checklist

ranuradh commented 4 months ago

Thanks @timtebeek yes I was looking into TypeCast and wasn't sure how to go about it. This recipe is now perfect!