google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.32k stars 13.3k forks source link

Eclipse format changes single-line javadocs #725

Open bentatham opened 1 year ago

bentatham commented 1 year ago

The eclipse-java-google-style.xml specifies that javadoc should always be the "basic" format:

The basic formatting of Javadoc blocks is as seen in this example:

/**
 * Multiple lines of Javadoc text are written here,
 * wrapped normally...
 */
public int method(String p1) { ... }

but that single-line javadocs are allowed when it fits on one line.

Other tools (like that google formatter in spotless maven plugin) reflows this to a single line when possible.

The solution is to change one settings in the eclipse format profile to be:

<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>