-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes potential
StringIndexOutOfBoundsException
in Java parser (#5003)
* Fixes potential `StringIndexOutOfBoundsException` in Java parser ``` java.lang.StringIndexOutOfBoundsException: begin 1495, end 1475, length 3807 java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606) java.base/java.lang.String.substring(String.java:2709) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitAnnotation(ReloadableJava17ParserVisitor.java:151) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitAnnotation(ReloadableJava17ParserVisitor.java:77) com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2921) com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.convert(ReloadableJava17ParserVisitor.java:1746) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.sortedModifiersAndAnnotations(ReloadableJava17ParserVisitor.java:2187) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariables(ReloadableJava17ParserVisitor.java:1593) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariable(ReloadableJava17ParserVisitor.java:1583) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.visitVariable(ReloadableJava17ParserVisitor.java:77) com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1045) com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.convert(ReloadableJava17ParserVisitor.java:1746) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.convert(ReloadableJava17ParserVisitor.java:1797) org.openrewrite.java.isolated.ReloadableJava17ParserVisitor.convert(ReloadableJava17ParserVisitor.java:1790) ... ``` * Push reproducer test * Show that the problem is unique to `@Value` handling * Test constructors as well, and With * Implementation * Restore JavaDoc types * Use java 1.5 format function * Exclude prefix handling for enums in convert method * Exclude prefix handling for enums in convert method * Add comment --------- Co-authored-by: Tim te Beek <tim@moderne.io> Co-authored-by: lingenj <jacob.van.lingen@moderne.io>
- Loading branch information
1 parent
efb5882
commit c50c746
Showing
5 changed files
with
96 additions
and
75 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