RFR: 8304915: Create jdk.internal.util.Architecture enum and apply

Roger Riggs rriggs at openjdk.org
Wed Apr 5 17:18:15 UTC 2023


On Wed, 5 Apr 2023 16:23:08 GMT, Glavo <duke at openjdk.org> wrote:

>> Define an internal jdk.internal.util.Architecture enumeration and static methods to replace uses of the system property `os.arch`.
>> The enumeration values are defined to match those used in the build.
>> The initial values are: `X64, X86, IA64, ARM, AARCH64, RISCV64, S390X, PPC64LE`
>> Note that `amd64` and `x86_64` in the build are represented by `X64`.
>> The values of the system property `os.arch` is unchanged.
>> 
>> The API is similar to the jdk.internal.util.OperatingSystem enum created by #[12931](https://git.openjdk.org/jdk/pull/12931).
>> Uses in `java.base` and a few others are included but other modules will be done in separate PRs.
>
> src/java.base/share/classes/jdk/internal/util/Architecture.java line 77:
> 
>> 75:      * {@return {@code true} if the current architecture is IA64}
>> 76:      */
>> 77:     public static boolean isIA64() {
> 
> Why is the name case correct only for IA-64, while `AArch64`, `RISC-V 64` and other architectures only have the first letter capitalized?
> 
> I think names like `isRiscv64`, `isPpc64le`, and `isAarch64` are quite ugly, and there is no precedent yet.

Yes, the capitalization names should be disciplined. In the enum, there are all uppercase, following the style of manifest constants and enums. In the build they are always lower case. Camel case is usually used for method names.
Using all upper case would make them consistent with the Enum names.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13357#discussion_r1158801096



More information about the client-libs-dev mailing list