openrewrite / rewrite-static-analysis

OpenRewrite recipes for identifying and fixing static analysis issues.
Apache License 2.0
27 stars 43 forks source link

Modifier order of javadoc tags #283

Open ahoehma opened 3 months ago

ahoehma commented 3 months ago

What problem are you trying to solve?

Lets imagine you have wrong class javadoc like this:

/**
 * @param <T>
 *          type of product
 * @author John 
 * @since 2020.1.0
 */

Checkstyle tell this violates https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#CHDBEFIF

Describe the solution you'd like

I would like to have recipe which corrects the order of the javadoc tags

Have you considered any alternatives or workarounds?

Manual fixing all these files.

Additional context

May org.openrewrite.staticanalysis.ModifierOrder could be used as a base?

Are you interested in [contributing this feature to OpenRewrite]

(https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md#new-features)?

I would like to try it :)

timtebeek commented 2 months ago

Thanks for the suggestion! Would love to see a recipe that rectifies this indeed; I think it should be fairly straightforward to have a visitor for JavaDocs reorder tag elements in this way. Probably best to start with some unit tests and work back from there. Appreciate the offer to help!

And sorry it took us a while to spot your suggestion; I've been traveling and am just now catching up to all I've missed.