Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when parsing Javadoc containing {@link and no closing brace #5196

Open
greg-at-moderne opened this issue Mar 19, 2025 · 0 comments
Open
Labels
bug Something isn't working parser-java

Comments

@greg-at-moderne
Copy link
Contributor

greg-at-moderne commented Mar 19, 2025

What version of OpenRewrite are you using?

Current main = 7de8e67

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

    @Test
    void unclosedBraceOnLink() {
        rewriteRun(
          java(
            """
              class Test {
                 /**   
                  * {@link int
                  * Some other text.
                  * See {@link java.lang.String}
                  * @param arg description
                  */                  
                  void method(String arg) {
                  }
              }
              """
          )
        );
    }

in JavadocTest

What did you see instead / What is the full stack trace of any errors you encountered?

Caused by: org.openrewrite.java.JavaParsingException: Failed to convert for the following cursor stack:--- BEGIN PATH ---
JCCompilationUnit(sourceFile = Test.java)
JCClassDecl(name = Test, line = 1)
--- END PATH ---

	... 32 more
Caused by: java.lang.AssertionError
	at org.openrewrite.java.isolated.ReloadableJava17JavadocVisitor.whitespaceBefore(ReloadableJava17JavadocVisitor.java:1074)
	at org.openrewrite.java.isolated.ReloadableJava17JavadocVisitor.visitDocComment(ReloadableJava17JavadocVisitor.java:340)
	at org.openrewrite.java.isolated.ReloadableJava17JavadocVisitor.visitDocComment(ReloadableJava17JavadocVisitor.java:52)
	at com.sun.tools.javac.tree.DCTree$DCDocComment.accept(DCTree.java:138)
	at com.sun.source.util.DocTreeScanner.scan(DocTreeScanner.java:84)
	at org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.formatWithCommentTree(ReloadableJava17ParserVisitor.java:2385)
	at org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.convert(ReloadableJava17ParserVisitor.java:1758)
	... 30 more

Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-java
Projects
Status: Backlog
Development

No branches or pull requests

1 participant