Skip to content

Parser error on multiline javadoc tag #5263

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

Merged
merged 7 commits into from
Aug 20, 2025

Conversation

rlsanders4
Copy link
Contributor

What's changed?

This PR provides a test case to demonstrate a parsing error that occurs on javadoc comments:

[When parsing and printing the source code back to text without modifications, the printed source didn't match the original source code. This means there is a bug in the parser implementation itself. Please open an issue to report this, providing a sample of the code that generated this error for "com/abc/Server.java":
diff --git a/com/abc/Server.java b/com/abc/Server.java
index 8023007..29f2d3d 100644
--- a/com/abc/Server.java
+++ b/com/abc/Server.java
@@ -2,8 +2,7 @@ 
 public class Server {
   /**
    * @see com.abc.Server#load(
-   * java.lang.
-   * String)
+   * java.lang.Stringng)
    */
   public void load(String str) {
   }
] 
expected: 
  "package com.abc;
  public class Server {
    /**
     * @see com.abc.Server#load(
     * java.lang.
     * String)
     */
    public void load(String str) {
    }
  }"
 but was: 
  "package com.abc;
  public class Server {
    /**
     * @see com.abc.Server#load(
     * java.lang.Stringng)
     */
    public void load(String str) {
    }
  }"

Anyone you would like to review specifically?

@timtebeek

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@timtebeek
Copy link
Member

timtebeek commented Apr 7, 2025

Thanks for the runnable example! Odd how we're repeating those last two characters. 🤔

Any chance you've briefly explored a fix already? Just so we know what to expect. No problem if not; still appreciated. 🙏🏻

@timtebeek timtebeek added bug Something isn't working test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail javadoc labels Apr 7, 2025
@rlsanders4
Copy link
Contributor Author

I have not looked into a fix for this yet.

@timtebeek timtebeek changed the title Parser error on multiline javadoc comment Parser error on multiline javadoc tag May 27, 2025
@timtebeek timtebeek marked this pull request as ready for review August 20, 2025 12:12
Copy link
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the runnable example. Should help to now parse & modify files containing these newlines going forward.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Aug 20, 2025
@timtebeek timtebeek merged commit f8ade2a into openrewrite:main Aug 20, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javadoc test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants