Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread Volkan Yazici
On Fri, 1 Aug 2025 16:16:01 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread Chen Liang
On Fri, 1 Aug 2025 20:19:33 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1093: >> >>> 1091: * startup. This should not be used to find fields in >>> non-trusted code. >>> 1092: * Use the {@link #objectFieldOffset(Field) Field}-accepting >>

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread Chen Liang
On Fri, 1 Aug 2025 18:46:53 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test update advised by volkan > > src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1093: > >> 1091: * star

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread Chen Liang
On Fri, 1 Aug 2025 18:43:04 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test update advised by volkan > > src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1108: > >> 1106: if

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread John R Rose
On Fri, 1 Aug 2025 16:16:01 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread ExE Boss
On Fri, 1 Aug 2025 16:16:01 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-08-01 Thread Chen Liang
On Mon, 7 Jul 2025 12:05:36 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java >> line 405: >> >>> 403: throw new IllegalArgumentException("Must be volatile >>> type"); >>> 404: >>> 405: if (Modifier.isS

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v6]

2025-08-01 Thread Chen Liang
On Fri, 1 Aug 2025 09:11:07 GMT, Volkan Yazici wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Less specific reasons for IAE > > test/jdk/jdk/internal/misc/Unsafe/AddressComputationContractTest.java line 64: > >> 62

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v7]

2025-08-01 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v6]

2025-08-01 Thread Volkan Yazici
On Thu, 31 Jul 2025 19:04:34 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't a

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v6]

2025-07-31 Thread Chen Liang
On Thu, 31 Jul 2025 19:04:34 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't a

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v6]

2025-07-31 Thread John R Rose
On Thu, 31 Jul 2025 19:04:34 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't a

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v6]

2025-07-31 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v5]

2025-07-31 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

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

2025-07-31 Thread Chen Liang
On Wed, 30 Jul 2025 17:32:57 GMT, John R Rose wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test to verify observed internal unsafe behaviors > > src/hotspot/share/prims/unsafe.cpp line 496: > >> 494: Symbol *

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

2025-07-30 Thread John R Rose
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-30 Thread John R Rose
On Tue, 24 Jun 2025 18:40:45 GMT, Chen Liang wrote: >> Don't think anyone is willing to change code here... > > That said, the only places that depend on this IAE behavior is the > AtomicXxxFieldUpdater classes. All other sites pass trusted fields into these > methods, of course besides the sun

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

2025-07-30 Thread John R Rose
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-08 Thread Doug Lea
On Tue, 8 Jul 2025 17:59:32 GMT, Alan Bateman wrote: >> Tracked in 8360541; I think we can implement in a separate patch. Don't know >> if this is worth backporting to MRs. > > Ah yes, I'd forgotten I created this issue to track clarifying the spec. Sure, the clarification is long past being us

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

2025-07-08 Thread Alan Bateman
On Mon, 7 Jul 2025 12:06:54 GMT, Chen Liang wrote: >> @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.

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

2025-07-08 Thread Chen Liang
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-07 Thread Chen Liang
On Mon, 7 Jul 2025 09:58:15 GMT, Viktor Klang 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 >>> s

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

2025-07-07 Thread Chen Liang
On Mon, 7 Jul 2025 09:54:28 GMT, Per Minborg wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test to verify observed internal unsafe behaviors > > src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger

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

2025-07-07 Thread Alan Bateman
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-07 Thread Viktor Klang
On Mon, 7 Jul 2025 09:56:07 GMT, Alan Bateman wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test to verify observed internal unsafe behaviors > > src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntege

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

2025-07-07 Thread Per Minborg
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-06 Thread Chen Liang
On Sun, 6 Jul 2025 18:32:56 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Test to verify observed internal unsafe behaviors > > test/jdk/jdk/internal/misc/Unsafe/AddressComputationContractTest.java li

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

2025-07-06 Thread ExE Boss
On Thu, 3 Jul 2025 18:41:27 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

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

2025-07-03 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-03 Thread Chen Liang
On Thu, 26 Jun 2025 05:42:24 GMT, ExE Boss wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't acc

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v2]

2025-07-03 Thread Chen Liang
On Thu, 3 Jul 2025 13:56:24 GMT, Chen Liang wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't ac

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v3]

2025-07-03 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

Re: RFR: 8361300: Document exceptions for Unsafe offset methods [v2]

2025-07-03 Thread Chen Liang
> Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accidentally introduce problems. Chen Liang has updated th

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-02 Thread Alan Bateman
On Tue, 24 Jun 2025 00:04:54 GMT, Chen Liang wrote: > Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accid

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-02 Thread ExE Boss
On Tue, 24 Jun 2025 00:04:54 GMT, Chen Liang wrote: > Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accid

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-02 Thread Chen Liang
On Tue, 24 Jun 2025 00:04:54 GMT, Chen Liang wrote: > Unsafe throws IAE for misusing static vs instance fields, and it's revealed > that AtomicXxxFieldUpdaters are using this mechanism to reject static fields. > This is not a good practice, but we can at least document this so we don't > accid

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-02 Thread Chen Liang
On Tue, 24 Jun 2025 18:34:02 GMT, ExE Boss wrote: >> Unsafe throws IAE for misusing static vs instance fields, and it's revealed >> that AtomicXxxFieldUpdaters are using this mechanism to reject static >> fields. This is not a good practice, but we can at least document this so we >> don't acc

Re: RFR: 8361300: Document exceptions for Unsafe offset methods

2025-07-02 Thread Chen Liang
On Tue, 24 Jun 2025 18:16:29 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1070: >> >>> 1068: * >>> 1069: * @throws NullPointerException if the field is {@code null} >>> 1070: * @throws IllegalArgumentException if the field is static >>