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

StackOverFlowException when parsing a file #4487

Open
uhafner opened this issue Sep 12, 2024 · 0 comments
Open

StackOverFlowException when parsing a file #4487

uhafner opened this issue Sep 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@uhafner
Copy link

uhafner commented Sep 12, 2024

What version of OpenRewrite are you using?

I am using

  • <rewrite-maven-plugin.version>5.39.2</rewrite-maven-plugin.version>
  • <rewrite-testing-frameworks.version>2.17.1</rewrite-testing-frameworks.version>
  • <rewrite-static-analysis.version>1.15.0</rewrite-static-analysis.version>
  • <rewrite-migrate-java.version>2.23.0</rewrite-migrate-java.version>
  • <rewrite-recommendations.version>1.8.4</rewrite-recommendations.version>

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project. I did run the command mvn -X clean rewrite:run.

See https://github.com/uhafner/codingstyle for details. The OpenRewrite configuration is visible in the pom.xml.

What is the smallest, simplest way to reproduce the problem?

package edu.hm.hafner.util;

public abstract class AbstractComparableTest<T extends Comparable<T>> {
    void error() {
        T left = createSmallerSut();

        // rest omitted
    }

    protected abstract T createSmallerSut();

    protected abstract T createGreaterSut();
}

What did you expect to see?

No exception.

What did you see instead?

Exception, see stacktrace below.

What is the full stack trace of any errors you encountered?

org.openrewrite.internal.RecipeRunException: java.lang.StackOverflowError
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:287)
    at org.openrewrite.TreeVisitor.visitAndCast (TreeVisitor.java:317)
    at org.openrewrite.java.JavaVisitor.visitRightPadded (JavaVisitor.java:1365)
    at org.openrewrite.java.JavaVisitor.lambda$visitBlock$4 (JavaVisitor.java:397)
    at org.openrewrite.internal.ListUtils.map (ListUtils.java:176)
    at org.openrewrite.java.JavaVisitor.visitBlock (JavaVisitor.java:396)
    at org.openrewrite.java.JavaIsoVisitor.visitBlock (JavaIsoVisitor.java:88)
    at org.openrewrite.java.JavaIsoVisitor.visitBlock (JavaIsoVisitor.java:30)
    at org.openrewrite.java.tree.J$Block.acceptJava (J.java:838)
    at org.openrewrite.java.tree.J.accept (J.java:59)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:245)
    at org.openrewrite.TreeVisitor.visitAndCast (TreeVisitor.java:317)
    at org.openrewrite.java.JavaVisitor.visitMethodDeclaration (JavaVisitor.java:879)
    at org.openrewrite.java.JavaIsoVisitor.visitMethodDeclaration (JavaIsoVisitor.java:224)
    at org.openrewrite.java.JavaIsoVisitor.visitMethodDeclaration (JavaIsoVisitor.java:30)
    at org.openrewrite.java.tree.J$MethodDeclaration.acceptJava (J.java:3651)
    at org.openrewrite.java.tree.J.accept (J.java:59)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:245)
    at org.openrewrite.TreeVisitor.visitAndCast (TreeVisitor.java:317)
    at org.openrewrite.java.JavaVisitor.visitRightPadded (JavaVisitor.java:1365)
    at org.openrewrite.java.JavaVisitor.lambda$visitBlock$4 (JavaVisitor.java:397)
    at org.openrewrite.internal.ListUtils.map (ListUtils.java:176)
    at org.openrewrite.java.JavaVisitor.visitBlock (JavaVisitor.java:396)
    at org.openrewrite.java.JavaIsoVisitor.visitBlock (JavaIsoVisitor.java:88)
    at org.openrewrite.java.JavaIsoVisitor.visitBlock (JavaIsoVisitor.java:30)
    at org.openrewrite.java.tree.J$Block.acceptJava (J.java:838)
    at org.openrewrite.java.tree.J.accept (J.java:59)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:245)
    at org.openrewrite.TreeVisitor.visitAndCast (TreeVisitor.java:317)
    at org.openrewrite.java.JavaVisitor.visitClassDeclaration (JavaVisitor.java:484)
    at org.openrewrite.java.JavaIsoVisitor.visitClassDeclaration (JavaIsoVisitor.java:108)
    at org.openrewrite.java.JavaIsoVisitor.visitClassDeclaration (JavaIsoVisitor.java:30)
    at org.openrewrite.java.tree.J$ClassDeclaration.acceptJava (J.java:1278)
    at org.openrewrite.java.tree.J.accept (J.java:59)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:245)
    at org.openrewrite.TreeVisitor.visitAndCast (TreeVisitor.java:317)
    at org.openrewrite.java.JavaVisitor.lambda$visitCompilationUnit$10 (JavaVisitor.java:497)
    at org.openrewrite.internal.ListUtils.map (ListUtils.java:176)
    at org.openrewrite.java.JavaVisitor.visitCompilationUnit (JavaVisitor.java:497)
    at org.openrewrite.java.JavaIsoVisitor.visitCompilationUnit (JavaIsoVisitor.java:113)
    at org.openrewrite.java.JavaIsoVisitor.visitCompilationUnit (JavaIsoVisitor.java:30)
    at org.openrewrite.java.tree.J$CompilationUnit.acceptJava (J.java:1549)
    at org.openrewrite.java.tree.J.accept (J.java:59)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:245)
    at org.openrewrite.TreeVisitor.visit (TreeVisitor.java:147)
    at org.openrewrite.Preconditions$Check.visit (Preconditions.java:175)
    at org.openrewrite.Preconditions$Check.visit (Preconditions.java:145)
    at org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$6 (RecipeRunCycle.java:182)
    at io.micrometer.core.instrument.AbstractTimer.recordCallable (AbstractTimer.java:178)
    at org.openrewrite.table.RecipeRunStats.recordEdit (RecipeRunStats.java:67)
    at org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$7 (RecipeRunCycle.java:178)
    at org.openrewrite.scheduling.RecipeStack.reduce (RecipeStack.java:57)
    at org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$8 (RecipeRunCycle.java:151)
    at org.openrewrite.internal.InMemoryLargeSourceSet.lambda$edit$0 (InMemoryLargeSourceSet.java:66)
    at org.openrewrite.internal.ListUtils.map (ListUtils.java:176)
    at org.openrewrite.internal.InMemoryLargeSourceSet.edit (InMemoryLargeSourceSet.java:65)
    at org.openrewrite.scheduling.RecipeRunCycle.editSources (RecipeRunCycle.java:150)
    at org.openrewrite.RecipeScheduler.runRecipeCycles (RecipeScheduler.java:87)
    at org.openrewrite.RecipeScheduler.scheduleRun (RecipeScheduler.java:41)
    at org.openrewrite.Recipe.run (Recipe.java:376)
    at org.openrewrite.Recipe.run (Recipe.java:372)
    at org.openrewrite.Recipe.run (Recipe.java:368)
    at org.openrewrite.maven.AbstractRewriteBaseRunMojo.runRecipe (AbstractRewriteBaseRunMojo.java:219)
    at org.openrewrite.maven.AbstractRewriteBaseRunMojo.listResults (AbstractRewriteBaseRunMojo.java:130)
    at org.openrewrite.maven.AbstractRewriteRunMojo.execute (AbstractRewriteRunMojo.java:63)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: java.lang.StackOverflowError
    at java.lang.StringBuilder.<init> (StringBuilder.java:106)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:651)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:642)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:663)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:642)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:663)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:642)
    at org.openrewrite.java.tree.TypeUtils.toString (TypeUtils.java:663)

Are you interested in [contributing a fix to OpenRewrite]

Not right now.

@uhafner uhafner added the bug Something isn't working label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant