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

Rewrite fails with java.lang.NoSuchMethodError: com.sun.tools.javac.tree.JCTree$JCVariableDecl.declaredUsingVar()Z #5131

Open
lwojtysiak opened this issue Mar 5, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@lwojtysiak
Copy link

lwojtysiak commented Mar 5, 2025

What version of OpenRewrite are you using?

I am using

  • rewrite-maven-plugin v6.2.2
  • rewrite-spring v6.2.1

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a multi-module project.

<plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>6.2.2</version>
                <configuration>
                    <exportDatatables>true</exportDatatables>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.springdoc.SpringFoxToSpringDoc</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-spring</artifactId>
                        <version>6.2.1</version>
                    </dependency>
                </dependencies>
            </plugin>

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

I have a Java 11 project with spring-boot 2.3.12 and probably in each class which contains var i got exception

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

[WARNING] There were problems parsing commons\src\main\java\xxxx\SomeClass.java
[WARNING] java.lang.NoSuchMethodError: com.sun.tools.javac.tree.JCTree$JCVariableDecl.declaredUsingVar()Z
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.visitVariables(ReloadableJava11ParserVisitor.java:1555)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.visitVariable(ReloadableJava11ParserVisitor.java:1504)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.visitVariable(ReloadableJava11ParserVisitor.java:73)
  com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:974)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convert(ReloadableJava11ParserVisitor.java:1665)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convert(ReloadableJava11ParserVisitor.java:1709)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convertAll(ReloadableJava11ParserVisitor.java:1777)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convertAll(ReloadableJava11ParserVisitor.java:1764)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.visitLambdaExpression(ReloadableJava11ParserVisitor.java:752)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.visitLambdaExpression(ReloadableJava11ParserVisitor.java:73)
  com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1815)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convert(ReloadableJava11ParserVisitor.java:1665)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convert(ReloadableJava11ParserVisitor.java:1709)
  org.openrewrite.java.isolated.ReloadableJava11ParserVisitor.convertAll(ReloadableJava11ParserVisitor.java:1777)
  ...
[WARNING] The recipe produced 3768 warning(s). Please report this to the recipe author.

Are you interested in contributing a fix to OpenRewrite?

@lwojtysiak lwojtysiak added the bug Something isn't working label Mar 5, 2025
@knutwannheden
Copy link
Contributor

Indeed, when I check older JDK 11 releases (e.g. 11.0.14) then this method doesn't exist. One workaround would be to upgrade to a newer JDK (e.g. 11.0.24), but I think we will have to find a solution that also supports older JDK 11 versions.

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

2 participants