-
Notifications
You must be signed in to change notification settings - Fork 82
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
Recipe ReplaceLocalizedStreamMethods #532
Recipe ReplaceLocalizedStreamMethods #532
Conversation
src/test/java/org/openrewrite/java/migrate/ReplaceLocalizedStreamMethodsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/ReplaceLocalizedStreamMethodsTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/ReplaceLocalizedStreamMethods.java
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @BhavanaPidapa ! I've done a few quick polish commits but with that we're good from my side. @cjobinabo can do the final review & merge.
src/main/java/org/openrewrite/java/migrate/ReplaceLocalizedStreamMethods.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/ReplaceLocalizedStreamMethods.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public String getDescription() { | ||
return "Replace `Runtime.getLocalizedInputStream(InputStream)` and `Runtime.getLocalizedOutputStream(with the argument)` with their direct arguments."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the description, I think it would be helpful to add some info about why this change is made. That the earlier implementation of these methods simply returned the input parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the description as mentioned.
What's changed?
This PR contains recipe - org.openrewrite.java.migrate.ReplaceLocalizedStreamMethods

Rule:
What's your motivation?
This custom recipe replaces the occurrences of Runtime.getLocalizedInputStream and Runtime.getLocalizedOutputStream methods. The occurrence of getLocalizedInputStream(in) is replaced with in parameter and getLocalizedOutputStream(out) is replaced with out parameter.
Anyone you would like to review specifically?
@timtebeek @cjobinabo
Have you considered any alternatives or workarounds?
I created sample files, created a local plugin using
./gradlew publishToMavenLocal then ran it in the Java8 Sample App using mvn rewrite:dryRun
Attaching the rewrite.patch file
rewrite.patch
Checklist