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

Joel Sikström duke at openjdk.org
Thu Sep 12 14:00:41 UTC 2024


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.

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

Commit messages:
 - 8337674: ZGC: Consistent style for naming private static constants

Changes: https://git.openjdk.org/jdk/pull/20968/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20968&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8337674
  Stats: 62 lines in 24 files changed: 0 ins; 0 del; 62 mod
  Patch: https://git.openjdk.org/jdk/pull/20968.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20968/head:pull/20968

PR: https://git.openjdk.org/jdk/pull/20968


More information about the hotspot-dev mailing list