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

David M. Lloyd duke at openjdk.org
Thu Apr 6 15:31:14 UTC 2023


On Thu, 6 Apr 2023 08:00:43 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Correct spelling of isAARCH64 in WIndows AttachProviderImpl
>
> src/java.base/share/classes/jdk/internal/util/Architecture.java line 47:
> 
>> 45: 
>> 46:     // Cache a copy of the array for lightweight indexing
>> 47:     private static final Architecture[] archValues = Architecture.values();
> 
> This needs to be annotated with `@jdk.internal.vm.annotation.Stable` for `Architecture.current()` to be constant foldable:
> Suggestion:
> 
>     private static final @Stable Architecture[] archValues = Architecture.values();

Even if it's `static` *and* `final`? I thought `@Stable` exists to "...process non-null stable fields (final or otherwise) in a similar manner to static final fields with respect to promoting the field's value to a constant", implying that `static final` fields already have this property.

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

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



More information about the client-libs-dev mailing list