What version of OpenRewrite are you using?
I was using the latest version as of 2024-02-14, I bet this hasn't been fixed in the meantime because it is an edge case.
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the problem?
A test base class uses both JUnit 4 and Jupiter, as a consequence its setup method is annotated with both @Before and @BeforeEach. The recipe will now replace the old @Before with the already present @BeforeEach annotation causing
Duplicate annotation. The declaration of 'org.junit.jupiter.api.BeforeEach' does not have a valid java.lang.annotation.Repeatable annotation
...
class TestBase {
@Before
@BeforeEach
void setup() {
//...
}
}
While rare this issue could pop up in all kinds of unexpected places, so it might be worth introducing something like MaybeChangeType that considers the already present annotations.
What is the full stack trace of any errors you encountered?
see above
No
What version of OpenRewrite are you using?
I was using the latest version as of 2024-02-14, I bet this hasn't been fixed in the meantime because it is an edge case.
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the problem?
A test base class uses both JUnit 4 and Jupiter, as a consequence its
setupmethod is annotated with both@Beforeand@BeforeEach. The recipe will now replace the old@Beforewith the already present@BeforeEachannotation causingWhile rare this issue could pop up in all kinds of unexpected places, so it might be worth introducing something like
MaybeChangeTypethat considers the already present annotations.What is the full stack trace of any errors you encountered?
see above
Are you interested in contributing a fix to OpenRewrite?
No