spring-io / spring-javaformat

Apache License 2.0
795 stars 110 forks source link

Include MissingDeprecated in the default checks #420

Closed wilkinsona closed 1 month ago

wilkinsona commented 1 month ago

https://checkstyle.sourceforge.io/checks/annotation/missingdeprecated.html

Having @deprecated in the javadoc without @Deprecated on the element can lead to an inconsistent view of whether or not something is deprecated. The JLS requires compilers to warn when someone uses code that is annotated with @Deprecated. It does not require them to warn when code is documented with @deprecated, but javac does so. It would be good to always use @deprecated and @Deprecated together so that our code avoids this potential inconsistency.

If we do this, it would also make sense to change this setting in Eclipse:

https://github.com/spring-io/spring-javaformat/blob/cea1d86811d708121becae066af49c5f39db3fe9/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs#L48

This would also align with the cleanup settings where @Deprecated is added automatically when the javadoc contains @deprecated:

https://github.com/spring-io/spring-javaformat/blob/cea1d86811d708121becae066af49c5f39db3fe9/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.ui.prefs#L4