Skip to content

JavadocToMarkdownDocComment fails idempotency check #1126

@barbulescu

Description

@barbulescu

What version of OpenRewrite are you using?

I am using

  • Maven plugin 6.41.0
  • rewrite-migrate-java_ 3.36.0

How are you running OpenRewrite?

https://github.com/barbulescu/assertj/blob/javadoc-2-markdown/pom.xml#L410

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

    <profile>
      <id>openrewrite</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.openrewrite.maven</groupId>
            <artifactId>rewrite-maven-plugin</artifactId>
            <version>6.41.0</version>
            <configuration>
              <exportDatatables>true</exportDatatables>
              <activeRecipes>
                <recipe>org.openrewrite.java.migrate.lang.JavadocToMarkdownDocComment</recipe>
              </activeRecipes>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.openrewrite.recipe</groupId>
                <artifactId>rewrite-migrate-java</artifactId>
                <version>3.36.0</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>

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

I am not able to reproduce with an unit test.

What did you expect to see?

Javadoc to Markdown migration performed.

What did you see instead?

[WARNING] java.lang.IllegalStateException: assertj-core/src/main/java/org/assertj/core/api/AbstractDoubleArrayAssert.java is not print idempotent. 
diff --git a//assertj/assertj-core/src/main/java/org/assertj/core/api/AbstractDoubleArrayAssert.java b//assertj/assertj-core/src/main/java/org/assertj/core/api/AbstractDoubleArrayAssert.java
index a6b54e2..aab8ac8 100644
--- a//assertj/assertj-core/src/main/java/org/assertj/core/api/AbstractDoubleArrayAssert.java
+++ b//assertj/assertj-core/src/main/java/org/assertj/core/api/AbstractDoubleArrayAssert.java
@@ -1527,7 +1527,7 @@ 
    * Example :
    * <pre><code class='java'>
    *
-   * // assertions will pass
+   *//  assertions will pass
    * assertThat(new double[] { 1.0, 1.0, 1.0 }).containsAnyOf(new Double[] { 1.0 })
    * assertThat(new double[] { 1.0, 1.0, 1.0 }).containsAnyOf(new Double[] { 2.0, 2.0, 2.0, 1.0 });
    *

  org.openrewrite.Parser.requirePrintEqualsInput(Parser.java:52)

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

see above

Are you interested in contributing a fix to OpenRewrite?

I tried to create an unit test, but it passes with the same javadoc.
Also I observed that it fails only when it is a single blank in front - it works with 2 or more blanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions