Skip to content

InstanceOf.getClazz() is null in CheckStyle's Java 19+ InputRecordPatternsPreview #5302

@Pankraz76

Description

@Pankraz76

test: checkstyle/checkstyle#16863

line 1:0 token recognition error at: '<u'
line 1:8 token recognition error at: '>'
[ERROR] The recipe produced an error. Please report this to the recipe author.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:01 min
[INFO] Finished at: 2025-04-14T18:06:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:6.6.1:run (default-cli) on project checkstyle: Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:6.6.1:run failed: Error while visiting src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/grammar/java19/InputRecordPatternsPreview.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:183)
[ERROR]   org.openrewrite.staticanalysis.OperatorWrap$1.visitInstanceOf(OperatorWrap.java:56)
[ERROR]   org.openrewrite.java.tree.J$InstanceOf.acceptJava(J.java:2996)
[ERROR]   org.openrewrite.java.tree.J.accept(J.java:58)
[ERROR]   org.openrewrite.TreeVisitor.visit(TreeVisitor.java:245)
[ERROR]   org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:70)
[ERROR]   org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:56)
[ERROR]   org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:311)
[ERROR]   org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1382)
[ERROR]   org.openrewrite.java.JavaVisitor.visitControlParentheses(JavaVisitor.java:528)
[ERROR]   org.openrewrite.java.JavaIsoVisitor.visitControlParentheses(JavaIsoVisitor.java:119)
[ERROR]   org.openrewrite.java.JavaIsoVisitor.visitControlParentheses(JavaIsoVisitor.java:30)
[ERROR]   org.openrewrite.java.tree.J$ControlParentheses.acceptJava(J.java:5002)
[ERROR]   org.openrewrite.java.tree.J.accept(J.java:58)
[ERROR]   org.openrewrite.TreeVisitor.visit(TreeVisitor.java:245)
[ERROR]   org.openrewrite.staticanalysis.OperatorWrap$1.visit(OperatorWrap.java:70)
[ERROR]   ...
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Process finished with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions