-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3/3] Implement joda to java time migration recipe (#591)
* [3/3] Implement joda to java time migration recipe * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix autosuggestions * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix unit test --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
460fad7
commit ec8663c
Showing
9 changed files
with
542 additions
and
108 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/main/java/org/openrewrite/java/migrate/joda/JodaTimeRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.java.migrate.joda; | ||
|
||
import org.openrewrite.ExecutionContext; | ||
import org.openrewrite.ScanningRecipe; | ||
import org.openrewrite.java.tree.J.VariableDeclarations.NamedVariable; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class JodaTimeRecipe extends ScanningRecipe<Set<NamedVariable>> { | ||
@Override | ||
public String getDisplayName() { | ||
return "Migrate Joda Time to Java Time"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Prefer the Java standard library over third-party usage of Joda Time."; | ||
} | ||
|
||
@Override | ||
public Set<NamedVariable> getInitialValue(ExecutionContext ctx) { | ||
return new HashSet<>(); | ||
} | ||
|
||
@Override | ||
public JodaTimeScanner getScanner(Set<NamedVariable> acc) { | ||
return new JodaTimeScanner(acc); | ||
} | ||
|
||
@Override | ||
public JodaTimeVisitor getVisitor(Set<NamedVariable> acc) { | ||
return new JodaTimeVisitor(acc); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.