RFR: 8337674: ZGC: Consistent style for naming private static constants

Joel Sikström duke at openjdk.org
Thu Sep 19 08:39:43 UTC 2024


On Thu, 12 Sep 2024 14:13:44 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> There are various styles for naming private static constants in ZGC. Some have a leading underscore, some begin with a lowercase letter and some start with an uppercase letter. The convention we feel is most appropriate, which also aligns with the hotspot style guide, is to have mixed-case with the first letter of each word capitalized when naming private static constants. There are also some occurrences of writing `const static` instead of the more commonly used `static const`, which should be made consistent to have the static keyword appear first.
>> 
>> The lines changed have been identified by running:
>> `rg "static const .* [[:lower:]].* =" src/hotspot/share/gc/z src/hotspot/*/*/gc/z`
>> `rg "static const .* _.* =" src/hotspot/share/gc/z src/hotspot/*/*/gc/z`
>> `rg "const static" src/hotspot/share/gc/z src/hotspot/*/*/gc/z`
>> 
>> The occurrences of `const static valid_max_address_offset_bits` have been converted to `static const` from `const static` but have not been renamed to mixed-case as the occurrences are not exposed outside their function(s).
>> 
>> Tested with tiers 1-3.
>
> Looks good.

Thank you for the reviews! @stefank @xmas92 @Hamlin-Li

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

PR Comment: https://git.openjdk.org/jdk/pull/20968#issuecomment-2360369471


More information about the hotspot-dev mailing list