RFR: 8361300: Document exceptions for Unsafe offset methods [v4]

Chen Liang liach at openjdk.org
Mon Jul 7 12:09:40 UTC 2025


On Mon, 7 Jul 2025 09:58:15 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java line 407:
>> 
>>> 405:             if (Modifier.isStatic(modifiers))
>>> 406:                 throw new IllegalArgumentException("Must not be a static field");
>>> 407: 
>> 
>> @viktorklang-ora @DougLea Should we update the Atomic*FieldUpdater to specify the IAE when the factory method is called with a static Field?
>
> @AlanBateman Yeah, I think that makes sense—IIRC it's been that way in practice since forever, but making it clear in documentation seems like the right thing to do.

Tracked in 8360541; I think we can implement in a separate patch. Don't know if this is worth backporting to MRs.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25945#discussion_r2189865695


More information about the core-libs-dev mailing list