RFR: 8311227: Add .editorconfig so IDEs would pick up the common settings automatically: indent, trim trailing whitespace
Erik Joelsson
erikj at openjdk.org
Thu Mar 6 14:06:55 UTC 2025
On Wed, 19 Feb 2025 12:27:58 GMT, David Linus Briemann <duke at openjdk.org> wrote:
> Add an .editorconfig to define indentation, trim trailing whitespace and open curly brace position for C++ and Java.
> This allows various editors to easily infer basics of the coding style.
Attempts at introducing any kind of code standard in OpenJDK has historically failed. It's a touchy subject to many. The bug description only really mentions `trim_trailing_whitespace` and since we are already enforcing this through jcheck, I don't see a problem or controversy adding that configuration here. As for the rest, I'm unsure.
The `indent_brace_style` isn't listed as an official property of EditorConfig (https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties). Is it actually picked up by any editor? Regardless, this isn't something that can just be snuck in.
What does `indent_style = tab` actually mean for makefiles? The tab character is used for defining recipe lines. Either an editor understands makefiles or it doesn't, I don't think this setting will be helpful. Also, most of our makefiles are *.gmk.
Defining indent_size for other source files is likely controversial, but if we were to go that route, then the set of `cpp,hpp,c,h` is not complete. Defining `indent_style = space` is likely ok for most kinds of sources, but again, I don't think we can just sneak this in like this.
My suggestion would be to only include the `trim_trailing_whitespace` line if you want to get this file in. After that you are free to start campaigning for more settings, but be prepared to work for it.
-------------
PR Review: https://git.openjdk.org/jdk/pull/23693#pullrequestreview-2664546757
More information about the build-dev
mailing list