Consider the following JavaDoc:
/**
* Test method for
* {@link MySelectionStyleConfiguration#configureSelectionStyle(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)}.
*
*/
Whenever I save the JUnit5 test class this comment belongs in, the {@link }
is re-formatted to be on one line, which is correct, otherwise the Maven Checkstyle plugin will throw an error if I try to introduce a line break in the link: (javadoc) SingleLineJavadoc: Javadoc comment at column 78 has parse error. Details: mismatched input '\n' expecting MEMBER while parsing REFERENCE
. (Also I reckon the link wouldn't resolve correctly in the API docs which are rendered from this.)
However, the Maven Checkstyle plugin will also throw an error if I leave the long link line as is: (sizes) LineLength: Line is longer than 100 characters (found 125).
.
Is there a way to resolve this?
{@link }
tags in JavaDoc (in test classes most obvisouly, but perhaps also elsewhere) should be excempted.I can leave out the package names from the link, but I'd like to keep them in there so that they resolve to one thing only and not potentially to something that is named equally.
It can be done with "ignorePattern" property of LineLength check https://checkstyle.sourceforge.io/config_sizes.html#LineLength
In your case, something like
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^ \* \{@link .*$"/>
</module>
will solve problem.