-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenRewrite are you using?
I am using
- OpenRewrite v8.69.0
- Maven/Gradle plugin v7.23.0
- Static Analysis: v2.24.0
How are you running OpenRewrite?
I am using the Gradle plugin, and my project is a single module project.
What is the smallest, simplest way to reproduce the problem?
public class Example {
void example() {
var dtf = DateTimeFormatter.ofPattern("YYYY-ww");
}
}What did you expect to see?
Because the format uses week-of-year, I expect YYYY (week year) to be left alone.
public class Example {
void example() {
var dtf = DateTimeFormatter.ofPattern("YYYY-ww");
}
}What did you see instead?
When used with week-of-year (ww), week-year (YYYY) is valid. However, ReplaceWeekYearWithYear replaces it in cases where it shouldn't, creating formats the author probably does not intend. In the example below, yyyy-ww uses calendar year and week-of-year instead of the desired week-year and week-of-year.
public class Example {
void example() {
var dtf = DateTimeFormatter.ofPattern("yyyy-ww");
}
}What is the full stack trace of any errors you encountered?
No errors, stack traces, or other unexpected output, just incorrect behavior.
Are you interested in contributing a fix to OpenRewrite?
Yes!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done