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

Add failing test FindLiterals on Groovy code #5087

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pstreef
Copy link
Contributor

@pstreef pstreef commented Feb 22, 2025

Recipe name: Find literals

Recipe id: org.openrewrite.java.search.FindLiterals

Error:

:

Message:

begin 1, end 0, length 1

Detail:

java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1
java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)
java.base/java.lang.String.substring(String.java:2709)
org.openrewrite.java.search.FindLiterals$1.visitLiteral(FindLiterals.java:70)
org.openrewrite.java.search.FindLiterals$1.visitLiteral(FindLiterals.java:65)
org.openrewrite.java.search.FindLiterals_1_GroovyVisitor.visitLiteral(FindLiterals_1_GroovyVisitor.zig:81)
org.openrewrite.java.tree.J$Literal.acceptJava(J.java:3466)
org.openrewrite.java.tree.J.accept(J.java:58)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:250)
org.openrewrite.groovy.GroovyVisitor.lambda$visitGString$1(GroovyVisitor.java:64)
org.openrewrite.internal.ListUtils.map(ListUtils.java:244)
org.openrewrite.internal.ListUtils.map(ListUtils.java:267)
org.openrewrite.groovy.GroovyVisitor.visitGString(GroovyVisitor.java:64)
org.openrewrite.groovy.tree.G$GString.acceptGroovy(G.java:694)
org.openrewrite.groovy.tree.G.accept(G.java:47)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:250)
org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:320)
...

void findLiterals() {
rewriteRun(
spec -> spec.recipe(new FindLiterals("org.openrewrite.*")),
groovy("""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
groovy("""
groovy(
"""

@knutwannheden
Copy link
Contributor

This commit does not specifically address this issue, but it might fix it as a side effect: 6cc119a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants