-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
What version of OpenRewrite are you using?
OR current main (7edbbf01ab8a9b666ef3c2003ee7b8e0c66a4967)
rewrite-static-analysis (428d8b0)
What is the smallest, simplest way to reproduce the problem?
@Test
void newArrayBraces() {
rewriteRun(
//language=java
java(
"""
import java.util.Collection;
class A {
void test(Collection<Integer> args){
args.toArray(new Integer[]{});
}
}
"""
)
);
}in src/test/java/org/openrewrite/staticanalysis/ReplaceCollectionToArrayArgWithEmptyArrayTest.java
Observed
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:233)
at org.openrewrite.staticanalysis.ReplaceCollectionToArrayArgWithEmptyArray$ReplaceCollectionToArrayArgWithEmptyArrayVisitor.lambda$visitNewArray$0(ReplaceCollectionToArrayArgWithEmptyArray.java:79)
at org.openrewrite.staticanalysis.ReplaceCollectionToArrayArgWithEmptyArray$ReplaceCollectionToArrayArgWithEmptyArrayVisitor$$Lambda/0x000000f00146e550.apply(Unknown Source)
at org.openrewrite.internal.ListUtils.mapFirst(ListUtils.java:166)
at org.openrewrite.internal.ListUtils.mapFirst(ListUtils.java:183)
at org.openrewrite.staticanalysis.ReplaceCollectionToArrayArgWithEmptyArray$ReplaceCollectionToArrayArgWithEmptyArrayVisitor.visitNewArray(ReplaceCollectionToArrayArgWithEmptyArray.java:68)
at org.openrewrite.staticanalysis.ReplaceCollectionToArrayArgWithEmptyArray$ReplaceCollectionToArrayArgWithEmptyArrayVisitor.visitNewArray(ReplaceCollectionToArrayArgWithEmptyArray.java:61)
OSS repro
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Type
Projects
Status
Done