Open olayinkasf opened 1 month ago
I am using
I am using the Maven plugin, and my project is a single module project.
<plugin> <groupId>org.openrewrite.maven</groupId> <artifactId>rewrite-maven-plugin</artifactId> <version>5.32.1</version> <configuration> ... </configuration> </plugin>
class A { void foo(String bar) { final Set<TimeUnit> timeUnits = Set.of(); } }
Either use EnumSet.noneOf or do not do any rewrite
EnumSet.noneOf
class A { void foo(String bar) { final Set<TimeUnit> timeUnits = EnumSet.noneOf(TimeUnit.class); } }
Uses EnumSet.of which requires an argument and since there is none, the code below does not compile
EnumSet.of
class A { void foo(String bar) { final Set<TimeUnit> timeUnits = EnumSet.of(); } }
No exception from plugin. Rewritten code isn't compilable.
I can fix it when I have time but I don't know when I will so please feel free to do that.
Oh wow, thanks for reporting the issues you're finding! Seems like a straightforward special case replacement to get this fixed.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
Either use
EnumSet.noneOf
or do not do any rewriteWhat did you see instead?
Uses
EnumSet.of
which requires an argument and since there is none, the code below does not compileWhat is the full stack trace of any errors you encountered?
No exception from plugin. Rewritten code isn't compilable.
Are you interested in contributing a fix to OpenRewrite?
I can fix it when I have time but I don't know when I will so please feel free to do that.