Recipe Name:
Convert Return type to java.time.DateTimeFormatter
Description:
Convert Return type to java.time.DateTimeFormatter
Level:
warning
Language:
- java
- kotlin
Tags:
- framework specific
- java.time
- Joda-Time
- quality
Documentation
Migrate from org.joda.time.DateTimeFormatter to Java Time
Joda-Time DateTimeFormatter migrates to java.time DateTimeFormatter.
It's a same concept, an immutable formatter
BeforeDateTimeFormatter dtf = DateTimeFormat.fullDate();After
java.time.format.DateTimeFormatter dtf = java.time.format.DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL);References
Recipe
id: scw:java.time:Joda-Time:datetimeformatter-convert-return version: 10 metadata: name: Convert Return type to java.time.DateTimeFormatter shortDescription: Convert Return type to java.time.DateTimeFormatter level: warning language: java; kotlin enabled: true comment: |- Searches for a method return type of org.joda.time.format.DateTimeFormatter and provides fixes to migrate to a java.time equivalent. This recipe will cause broken code as part of an overall number of steps to perform a migration of Joda-Time to java.time. After migrating this instance creation to the java.time equivalent, subsequent method calls and usages of the instance may become invalid. Further Sensei recipes are available to help resolve many of these invalid usages. descriptionFile: descriptions/datetimeformatter.html tags: framework specific;java.time;Joda-Time;quality search: method: returnType: org.joda.time.format.DateTimeFormatter availableFixes: - name: Change return Type to java.time DateTimeFormatter actions: - changeType: type: java.time.format.DateTimeFormatter