openrewrite / rewrite

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

Javadoc link to array not preserved #3198

Closed mduerig closed 1 year ago

mduerig commented 1 year ago

OpenRewrite does not properly preserve Javadoc links to arrays:

/**
 * Foo {@link javax.jcr.Value[] values} bar.
 */

is incorrectly converted to

/**
 * Foo {@link javax.jcr.Valuevaluesbar. bar.
 */

when running mvn rewrite:run -Drewrite.activeRecipes=org.openrewrite.java.AddLicenseHeader_

timtebeek commented 1 year ago

Sorry to hear! That's a bug indeed, and annoying that it won't let you run recipes without producing such unwanted changes. Feel free to open a pull request to replicate the issue in a test, such that we can more easily pick this up when we have time.

mduerig commented 1 year ago

Test: https://github.com/openrewrite/rewrite/pull/3213

timtebeek commented 1 year ago

Thank you for adding a test! As also noted in https://github.com/openrewrite/rewrite/pull/3213#issuecomment-1538033667 I've merge the test already, and briefly explored what might cause this issue. It's either a problem printing the results back out, or a problem with how we parse the int[] in the code snippet (or both). Either way having the test helps to pick this up once we have time, or notify you here if it's resolved as part of other work.