-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenRewrite are you using?
I am using the rewrite-maven-plugin version 6.21.1 with the rewrite-static-analysis dependency version 2.20.0.
How are you running OpenRewrite?
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>6.21.1</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.staticanalysis.OperatorWrap</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-static-analysis</artifactId>
<version>2.20.0</version>
</dependency>
</dependencies>
</plugin>What is the smallest, simplest way to reproduce the problem?
package org.example;
import java.util.Arrays;
import java.util.Objects;
public record SomeRecord(
int field,
byte[] value
) {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SomeRecord f)) {
return false;
}
return field == f.field
&& Arrays.equals(value, f.value);
}
@Override
public int hashCode() {
return 31 * Objects.hash(field) + Arrays.hashCode(value);
}
}What did you expect to see?
No changes in my code :)
What did you see instead?
A failed rewrite run :(
What is the full stack trace of any errors you encountered?
[ERROR] Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:6.21.1:run (default-cli) on project rewrite-static-analysis: Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:6.21.1:run failed: Error while visiting src/main/java/org/example/SomeRecord.java: java.lang.NullPointerException: Cannot invoke "org.openrewrite.java.tree.J.getPrefix()" because the return value of "org.openrewrite.java.tree.J$InstanceOf.getClazz()" is null
[ERROR] org.openrewrite.staticanalysis.OperatorWrap$1.visitInstanceOf(OperatorWrap.java:184)
[ERROR] org.openrewrite.staticanalysis.OperatorWrap$1.visitInstanceOf(OperatorWrap.java:56)
[ERROR] org.openrewrite.java.tree.J$InstanceOf.acceptJava(J.java:3144)
[ERROR] org.openrewrite.java.tree.J.accept(J.java:55)
[ERROR] org.openrewrite.TreeVisitor.visit(TreeVisitor.java:242)
[ERROR] org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:71)
[ERROR] org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:56)
[ERROR] org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:309)
[ERROR] org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1310)
[ERROR] org.openrewrite.java.JavaVisitor.visitParentheses(JavaVisitor.java:1020)
[ERROR] org.openrewrite.java.JavaIsoVisitor.visitParentheses(JavaIsoVisitor.java:285)
[ERROR] org.openrewrite.java.JavaIsoVisitor.visitParentheses(JavaIsoVisitor.java:30)
[ERROR] org.openrewrite.java.tree.J$Parentheses.acceptJava(J.java:5087)
[ERROR] org.openrewrite.java.tree.J.accept(J.java:55)
[ERROR] org.openrewrite.TreeVisitor.visit(TreeVisitor.java:242)
[ERROR] org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:71)
[ERROR] ...
Are you interested in contributing a fix to OpenRewrite?
Might be :)
timtebeek
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done