RFR: 8323158: HotSpot Style Guide should specify more include ordering

Johan Sjölen jsjolen at openjdk.org
Wed Feb 5 12:42:13 UTC 2025


On Mon, 3 Feb 2025 12:14:53 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>>> A lot of these rules looks like they could be checked with some simple scripting or additions to jcheck. Have you considered that?
>> 
>> I haven't felt the urge to write such a script, but I know that others have scripts to sort the includes.
>
>> I haven't felt the urge to write such a script, but I know that others have scripts to sort the includes
> 
> Ok, it was just a suggestion. My experience is that while clearly written conventions/rules are important, the more they can be automated, the less hassle for everyone.

@dougxc,

We could use clang-format for these specific include rules.

For example, when we still had `precompiled.hpp` I had this in my `.clang-format` file:


IncludeCategories: # precompiled.hpp ALWAYS first
  - Regex: 'precompiled.hpp'
    Priority: 0
    SortPriority: 0


Implementing all of the rules for Clang format is left as an exercise to the reader, and the author would be very appreciative if someone posted their solution here :-).

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

PR Comment: https://git.openjdk.org/jdk/pull/23388#issuecomment-2636674949


More information about the build-dev mailing list