rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Remove fully qualified JavaDoc references from `TypesInUse` for `RemoveUnusedImports`

Open Pankraz76 opened this issue 8 months ago • 5 comments

What's changed?

  • https://github.com/junit-team/junit-framework/pull/4708

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • [ ] I've added unit tests to cover both positive and negative cases
  • [ ] I've read and applied the recipe conventions and best practices
  • [ ] I've used the IntelliJ IDEA auto-formatter on affected files

Pankraz76 avatar Jul 10 '25 08:07 Pankraz76

with:

image

without:

image

test working assuming version issue.

Pankraz76 avatar Jul 10 '25 08:07 Pankraz76

seems consistent:

  • https://github.com/Pankraz76/pmd/pull/4/files#r2203398773

Pankraz76 avatar Jul 13 '25 13:07 Pankraz76

still an issue:

  • https://github.com/google/guava/issues/7917
  • https://github.com/google/guava/issues/7917#issuecomment-3161383597

Pankraz76 avatar Aug 07 '25 09:08 Pankraz76

    @Nested
    @Issue("https://github.com/openrewrite/rewrite/pull/5738")
    class removeUnusedImportsDoc {

        @Test
        void usedInDoc() {
            rewriteRun(
              java(
                """
                  import java.util.Date;
                  import java.util.List;

                  /**
                   * referencing {@link Date} only in doc
                   */
                  class Test {
                      List list;
                  }
                """
              )
            );
        }

        @Test
        void usedInDocFullQualified() {
            rewriteRun(
              java(
                """
                  import java.util.Date;
                  import java.util.List;

                  /**
                   * referencing {@link java.util.Date} only in doc
                   */
                  class Test2 {
                      List list;
                  }
                """,
                """
                  import java.util.List;

                  /**
                   * referencing {@link java.util.Date} only in doc
                   */
                  class Test2 {
                      List list;
                  }
                """
              )
            );
        }
    }

still the case seem to be fixed, but i came across another issue, not able to fix the impl.

Feel free to incorporate. Thanks for considering.


Recipe was expected to make a change but made no changes.
java.lang.AssertionError: Recipe was expected to make a change but made no changes.
	at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:119)
	at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:95)
	at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
	at org.openrewrite.Recipe.run(Recipe.java:442)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:381)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
	at org.openrewrite.java.RemoveUnusedImportsTest$removeUnusedImportsDoc.usedInDocFullQualified(RemoveUnusedImportsTest.java:2299)
	at java.base/java.lang.invoke.LambdaForm$DMH/0x0000007001174400.invokeVirtual(LambdaForm$DMH)
	at java.base/java.lang.invoke.LambdaForm$MH/0x000000700109c800.invoke(LambdaForm$MH)
	at java.base/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Pankraz76 avatar Aug 08 '25 08:08 Pankraz76

no going to finish this, feel free to continue.

Thanks.

Pankraz76 avatar Aug 20 '25 16:08 Pankraz76