openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.15k stars 321 forks source link

CodeCleanup adds a space after comma in javadoc -> @link method arguments on every execution #3674

Closed vlsi closed 11 months ago

vlsi commented 11 months ago

What version of OpenRewrite are you using?

rewrite-recipe-bom:2.4.1 org.openrewrite.rewrite.gradle.plugin:6.4.3

How are you running OpenRewrite?

./gradlew rewriteRun, see https://github.com/pgjdbc/pgjdbc/pull/2979

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

  /**
   * @see java.sql.Connection#createArrayOf(String, Object[])
   */
  voit test() {
  }

What did you expect to see?

The code should be left intact.

What did you see instead?

Every execution adds a space before Object[] The code becomes like

  /**
   * @see java.sql.Connection#createArrayOf(String,     Object[])
   */
  voit test() {
  }

See https://github.com/pgjdbc/pgjdbc/blob/9cf9f36a1d3a1edd9286721f9c0b9cfa9e8422e3/pgjdbc/src/main/java/org/postgresql/PGConnection.java#L43

PS. It should probably be moved to rewrite-static-analysis

knutwannheden commented 11 months ago

The cause appears to be the org.openrewrite.java.format.MethodParamPad recipe.

knutwannheden commented 11 months ago

This issue has been fixed, but won't be immediately available on https://app.moderne.io/. Thanks for reporting!