RFR: 8311227: Add .editorconfig so IDEs would pick up the common settings automatically: indent, trim trailing whitespace

Magnus Ihse Bursie ihse at openjdk.org
Mon Mar 10 11:03:04 UTC 2025


On Mon, 10 Mar 2025 08:57:11 GMT, David Linus Briemann <duke at openjdk.org> wrote:

> I guess the question is: are these guidelines obligatory and if so why can we not define this in an editorconfig?

No, they are not. That's kind of the crux of the problem. 
* The Hotspot guidelines are followed to a great extent, but I'm pretty sure they also say something along the lines of  "if old code does not adhere to this, do not change everything blindly", which is exactly what an editor would do. 
* Hotspot is not the only C++ code in the JDK; and the rest of the native libraries has nothing even close to the Hotspot guidelines. Furthermore, there are imported 3rd party sources in the code base that are exempt from any kind of requirements.
* The Java guidelines, how official they may look, is not considered really applicable to the JDK code. I *guess* most Java code uses four spaces of indentation, but it is not a clear rule.

> I would not see much sense in only adding the trim_trailing_whitespace option. Then vital settings are missing and I have a file that conflicts with my local one :)

I apologize if such a solution would cause a conflict for your setup, but I seriously think that this is the only way forward. We can setup an editorconfig file that matches what jcheck already checks for, but not anything more. Then we can work on, going forward, to increase the official rules about code. That would allow jcheck to test for more aspects, and an editorconfig to be more explicit.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23693#issuecomment-2710191786
PR Comment: https://git.openjdk.org/jdk/pull/23693#issuecomment-2710196397


More information about the build-dev mailing list