Backport of #48446. Update the Eclipse formatter settings as follows:
* Split arguments for methods, constructors etc into separate lines when
they wrap
* Enable "joined wrapped lines", which basically means the formatter
will ignore existing line breaks and join and re-wrap statements. I
had originally hesitated about enabling this, but without it the
codebase's style won't be as consistent as it should be, defeating the
point of all this formatting business.
* Disable formatting between `// tag::` and `// end::` comments, which
are the code snippet markers for the docs. They need a different line
length, which isn't possible to configure separately.
* Detect and preserve aligned line comments at the end of consecutive
lines.
* And a bunch of other tweaks.
Also update the contribution guidelines.
This commit adds a Java source formatter and checker into the build process.
This is not yet enabled for any sub-projects - to format and check a
sub-project, add its Gradle path into `build.gradle` and run:
./gradlew spotlessApply
to format, and:
./gradlew spotlessJavaCheck
# or:
./gradlew precommit
to verify formatting.