-
Notifications
You must be signed in to change notification settings - Fork 77
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
[2/x] Implement joda to java time migration recipe #582
Conversation
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.
Some suggestions could not be made:
- src/main/java/org/openrewrite/java/migrate/joda/JodaTimeVisitor.java
- lines 133-135
src/main/java/org/openrewrite/java/migrate/joda/JodaTimeFlowSpec.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/joda/SafeCheckMarker.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/joda/templates/AbstractInstantTemplates.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/joda/JodaTimeFlowSpecTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/joda/JodaTimeFlowSpecTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/joda/JodaTimeFlowSpecTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/joda/JodaTimeScannerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/migrate/joda/JodaTimeScannerTest.java
Outdated
Show resolved
Hide resolved
…rTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…rTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ec.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…r.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…r.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ecTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ecTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ClassMap.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ractInstantTemplates.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/main/java/org/openrewrite/java/migrate/joda/JodaTimeFlowSpec.java
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
} | ||
} | ||
|
||
private static class HasJodaType extends JavaIsoVisitor<Boolean[]> { |
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.
Most OpenRewrite code uses AtomicBoolean
for this purpose.
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.
Great to see the progress here! I look forward to the recipes that will use these visitors to make it available for folks to run.
Merging this instance already, to clear out open PRs ahead of the release. |
A quick heads up that we can a recipe in bulk, and will enforce that on PRs in the near future that removed these unused fields: From 460fad7fec51d39bf5e3c02e0fb270946361e95e Mon Sep 17 00:00:00 2001
From: Tim te Beek <timtebeek@gmail.com>
Date: Wed, 23 Oct 2024 19:31:47 +0000
Subject: [PATCH] refactor: Kill your Zombie code
Use this link to re-run the recipe: https://app.moderne.io/builder/mybR2aHWC?organizationId=T3BlblJld3JpdGU%3D
Co-authored-by: Moderne <team@moderne.io>
---
.../java/migrate/joda/templates/DateTimeFormatTemplates.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java b/src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java
index 25d5ad37b0..324ea01037 100644
--- a/src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java
+++ b/src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java
@@ -25,8 +25,6 @@
public class DateTimeFormatTemplates {
private final MethodMatcher forPattern = new MethodMatcher(JODA_TIME_FORMAT + " forPattern(String)");
- private final MethodMatcher forStyle = new MethodMatcher(JODA_TIME_FORMAT + " forStyle(String)");
- private final MethodMatcher patternForStyle = new MethodMatcher(JODA_TIME_FORMAT + " patternForStyle(String, java.util.Locale)");
private final MethodMatcher shortDate = new MethodMatcher(JODA_TIME_FORMAT + " shortDate()");
private final MethodMatcher mediumDate = new MethodMatcher(JODA_TIME_FORMAT + " mediumDate()");
private final MethodMatcher longDate = new MethodMatcher(JODA_TIME_FORMAT + " longDate()"); Just in case you had planned to use those in the near future still. |
What's changed?
This pr is the second part of implementing the migration from Joda-Time to the Java Time API. It introduces a scanner that analyzes source files to identify variables that are unsafe to migrate.
A variable is considered unsafe if an expression referencing it doesn't have a direct replacement, or if the replacement has not yet been implemented. Any variable connected to an unsafe variable also becomes unsafe.
Key Changes:
Not Implemented Yet:
Checklist