You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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?
Oh wow, hadn't ever seen that pattern indeed. It'll be caused by us changing the type of the existing Before annotations to the new BeforeEach annotations.
If we would want to support this we'd have to revise that logic to also look for existing target annotations and remove those. That's sure possible, but I'd expect that to be rare and perhaps then not immediately worth the trouble for a one time migration. Would you agree there?
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 causingWhile 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
Are you interested in contributing a fix to OpenRewrite?
No
The text was updated successfully, but these errors were encountered: