rewrite-static-analysis icon indicating copy to clipboard operation
rewrite-static-analysis copied to clipboard

Private method `findNodeById(java.util.List<org.apache.maven.api.xml.XmlNode>, java.lang.String)` is never used

Open Pankraz76 opened this issue 8 months ago • 1 comments

Private method findNodeById(java.util.List<org.apache.maven.api.xml.XmlNode>, java.lang.String) is never used

  • https://github.com/apache/maven/pull/2310
  • https://github.com/apache/maven/pull/2310#issuecomment-2877236604

Pankraz76 avatar May 13 '25 16:05 Pankraz76

What version of OpenRewrite are you using?

I am using

  • OpenRewrite v1.2.3
  • Maven/Gradle plugin v1.2.3
  • rewrite-module v1.2.3

How are you running OpenRewrite?

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

<plugin>
  <groupId>org.openrewrite.maven</groupId>
  <artifactId>rewrite-maven-plugin</artifactId>
  <version>1.2.3</version>
  <configuration>
    ... 
  </configuration>
</plugin>

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

class A {
    void foo(String bar) {
        int i = 5;
    }
}

What did you expect to see?

class A {
    void foo(String bar) {
        int i = 5;
    }
}

What did you see instead?

class A {
    void foo(String bar) {
        int i = 5;
    }
}

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

stacktrace output here

Are you interested in contributing a fix to OpenRewrite?

Pankraz76 avatar May 13 '25 16:05 Pankraz76

We already have a recipe that does this: https://github.com/openrewrite/rewrite-static-analysis/blob/9c48fb1144f710a9672ab2dd9074ebe1b42fc73a/src/test/java/org/openrewrite/staticanalysis/RemoveUnusedPrivateMethodsTest.java#L35-L67

We can reopen if there's a reproducer unit test, or when there's more details to share based on attaching a JVM debugger: https://docs.moderne.io/user-documentation/moderne-ide-integration/how-to-guides/debugging-recipes/#step-4-debug-your-recipe

timtebeek avatar May 16 '25 01:05 timtebeek