RFR: 8364544: Extract the checks of AtomicXxxFieldUpdater into a common place [v2]

Steve Armstrong duke at openjdk.org
Tue Nov 25 02:52:34 UTC 2025


On Mon, 24 Nov 2025 01:18:41 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Steve Armstrong has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Replace legacy ReflectUtil with modern Reflection API
>>   
>>   Replaced sun.reflect.misc.ReflectUtil with jdk.internal.reflect.Reflection
>>   in atomic field updaters. Added getFieldWithAccess() method and
>>   FieldAndModifiers record to FieldUpdaterUtil to consolidate field
>>   access checking logic.
>
> This can also get rid of the last remaining uses of the legacy `sun.reflect.misc.ReflectUtil`:
> 
> --------------------------------------------------------------------------------
> 
> (`jdk.internal.reflect.Reflection` is already imported for `Reflection​.getCallerClass()`)

Thanks @ExE-Boss for the review! I've updated the code to replace the legacy `sun.reflect.misc.ReflectUtil` with the modern `jdk.internal.reflect.Reflection` API. The changes consolidate the field access checking into `FieldUpdaterUtil.getFieldWithAccess()` and use a record for `FieldAndModifiers`.

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

PR Comment: https://git.openjdk.org/jdk/pull/28464#issuecomment-3573569169


More information about the core-libs-dev mailing list