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

Problem parsing unknown Javadoc tag #3833

Merged
merged 21 commits into from
Dec 27, 2023

Conversation

TheMarvelFan
Copy link
Contributor

@TheMarvelFan TheMarvelFan commented Dec 18, 2023

Referencing issue

What's changed?

Modified the sourceBefore() method and visiteReturn() method to handle leading curly brace '{' with return annotations, i.e., cases like '{@return}' and '{@return}'. I will be adding commits that also modify the JavaDocPrinter to include the leading '{' when printing the modified javadoc.

Anyone you would like to review specifically?

@traceyyoshima or @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
Contributor

Thanks for getting this started @TheMarvelFan ! I've removed two classes from your other PR, which squash merge should resolve

As for the changes here probably best to add a test to verify that the changes here correctly handle the cases mentioned in #3750 (comment)

@timtebeek timtebeek added the bug Something isn't working label Dec 18, 2023
@timtebeek
Copy link
Contributor

timtebeek commented Dec 18, 2023

Once we're satisfied with the changes (but only then!), we should replicate the same to the other parsers to also fix this in Java 8, 11 and 21.

@TheMarvelFan
Copy link
Contributor Author

Hi @timtebeek,
Please review the modified files, and suggest changes if required.

@timtebeek
Copy link
Contributor

Hi @TheMarvelFan ; you seem to have added two files to the root of your repository fork:
https://github.com/TheMarvelFan/rewrite/tree/rewrite1
image

You likely intended to add those elsewhere; what's the reason you're using the file upload and not a git push?

@TheMarvelFan
Copy link
Contributor Author

Hi,
I initially intended to contribute to both this issue and issue #3757 using the same repository fork. For this purpose, I created another branch named "rewrite1", but I think I made a mistake somwhere, and when I tried pushing to rewrite one from origin on my local machine, I got an error which told me to "fetch first" and then push. I tried to fetch as well, but the error remained. So, I decided to upload the files to the rewrite1 branch instead of pushing. I am still not sure if the same cloned repository can be used to push different commits to two different open pull requests of the same upstream. I apologize for the inconvenience due to this.

@timtebeek
Copy link
Contributor

Yes you can use the same fork for multiple open pull requests, but it helps to start a branch for each new development you start, and not commit to the main branch. Otherwise you indeed run the risk of conflicts and diverging commits on the main branch.

@TheMarvelFan
Copy link
Contributor Author

I understand. I am still quite new to contributing to open source, but with time I will get better. Is there something I can do right now to correct this problem?

Copy link
Contributor

@traceyyoshima traceyyoshima left a comment

Choose a reason for hiding this comment

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

Hi @TheMarvelFan! The changes are looking good so far, thank you for fixing this bug!

I've added a few comments with information on the changes. Please let me know if you have any questions!

@TheMarvelFan
Copy link
Contributor Author

Hi @traceyyoshima,
Thanks for suggesting the changes. Please review the modified files and let me know if more changes are required.

@traceyyoshima
Copy link
Contributor

traceyyoshima commented Dec 27, 2023

Once we're satisfied with the changes (but only then!), we should replicate the same to the other parsers to also fix this in Java 8, 11 and 21.

@timtebeek It looks like the build is failing due to the marker implementation. Once that's fixed, I think the changes look good and we're ready to update the other parsers. What do you think?

Copy link
Contributor

@traceyyoshima traceyyoshima left a comment

Choose a reason for hiding this comment

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

Nearly there!

@traceyyoshima
Copy link
Contributor

@TheMarvelFan I've updated the PR with a few finishing touches, thank you for your work on this PR!

@traceyyoshima traceyyoshima marked this pull request as ready for review December 27, 2023 18:37
TheMarvelFan and others added 11 commits December 27, 2023 16:27
…ndomId() only when it is used as a parameter in an LST constructor.
…isitor.java to recognize a leading curly brace '{' in cases such as '{@return' and '{@return}'. The next commit will include changes to the printer class

that prints the corrected javadoc comments.
…loadableJava17JavadocVisitor.java

Replacing the modified ReloadableJava17JavadocVisitor.java with original file.
…n/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java
…org/openrewrite/java/UnknownJavadocTagTest.java

Changed location of added file.
…eading opening brace

Removed the file "UnkownJavadocTagTest.java", and added the tests it contained to this file.
TheMarvelFan and others added 10 commits December 27, 2023 16:27
…vadocTagTest.java

Removed the now obselete file as the tests it contained are now in rewrite/rewrite-java-tck/src/main/java/org/openrewrite/java/tree/JavadocTest.java
Restored sourceBefore method to its original, and modified the visitReturn method to deal with the leading curly brace before the return annotation.
Also added a private UUID uuid to ReloadableJava17JavadocVisitor/LeadingBraceMarkers to follow convention.
Added overlooked annotations
@traceyyoshima traceyyoshima merged commit 9acb6d7 into openrewrite:main Dec 27, 2023
1 check passed
@TheMarvelFan TheMarvelFan deleted the rewrite1 branch February 5, 2024 09:28
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
Archived in project
Development

Successfully merging this pull request may close these issues.

Problem parsing unknown Javadoc tag
3 participants