forked from openrewrite/rewrite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem parsing unknown Javadoc tag (openrewrite#3833)
* Added recipe for modifying references to 'UUID.randomUUID()' to 'Tree.randomId()', and test * Changed the recipe so that it only changes UUID.randomID() to Tree.randomId() only when it is used as a parameter in an LST constructor. * Modified the recipe as instructed. Improved the test statements * Modified sourceBefore() and visitReturn() in ReloadableJava17JavadocVisitor.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. * Delete rewrite-java/src/main/java/org/openrewrite/java/ReplaceUUIDRandomId.java * Delete rewrite-java/src/test/java/org/openrewrite/java/ReplaceUUIDRandomIdTest.java * Add files via upload * Delete rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java Replacing the modified ReloadableJava17JavadocVisitor.java with original file. * Rename ReloadableJava17JavadocVisitor.java to rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java * Rename UnknownJavadocTagTest.java to rewrite-java-test/src/test/java/org/openrewrite/java/UnknownJavadocTagTest.java Changed location of added file. * Update JavadocTest.java to include tests for return annotation with leading opening brace Removed the file "UnkownJavadocTagTest.java", and added the tests it contained to this file. * Delete rewrite-java-test/src/test/java/org/openrewrite/java/UnknownJavadocTagTest.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 * Update ReloadableJava17JavadocVisitor.java and restored sourceBefore 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. * Update ReloadableJava17JavadocVisitor.java Added overlooked annotations * Update ReloadableJava17JavadocVisitor.java * Update ReloadableJava17JavadocVisitor.java * Apply suggestions from code review * Update rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java * Update rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java * Update rewrite-java-17/src/main/java/org/openrewrite/java/isolated/ReloadableJava17JavadocVisitor.java * Renamed and moved marker, updated printer, and added changes to parser. --------- Co-authored-by: Tim te Beek <[email protected]> Co-authored-by: Tracey Yoshima <[email protected]>
- Loading branch information
1 parent
ff1712e
commit 9acb6d7
Showing
8 changed files
with
113 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
rewrite-java/src/main/java/org/openrewrite/java/marker/LeadingBrace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2023 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openrewrite.java.marker; | ||
|
||
import lombok.Value; | ||
import lombok.With; | ||
import org.openrewrite.marker.Marker; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* JavaDoc tags like @return that may be written with a leading brace. | ||
*/ | ||
@Value | ||
@With | ||
public class LeadingBrace implements Marker { | ||
UUID id; | ||
} |