Skip to content

Semicolon after class closing gets parsed into whitespace #5735

Open
@greg-at-moderne

Description

@greg-at-moderne

What version of OpenRewrite are you using?

current main. =fbcd4fcdb2d184c07fd7ce4e374b3d0da960d44b

What is the smallest, simplest way to reproduce the problem?

    @Test
    void semicolonAfterClass() {
        rewriteRun(
          // language=java
          java("class A{};")
       );
    }

added to JavaParserTest

What did you see instead?

JavaParserTest > semicolonAfterClass() FAILED
    java.lang.AssertionError: Source file was parsed into an LST that contains non-whitespace characters in its whitespace. This is indicative of a bug in the parser. 
    class A{}~~(non-whitespace)~~>;<~~
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:324)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:130)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:125)
        at org.openrewrite.java.JavaParserTest.semicolonAfterClass(JavaParserTest.java:399)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions