On Fri, 11 Feb 2022 13:51:38 GMT, liach <d...@openjdk.java.net> wrote:

>> Upon review of [8261407](https://bugs.openjdk.java.net/browse/JDK-8261407), 
>> by design, duplicate initialization of ReflectionFactory should be safe as 
>> it performs side-effect-free property read actions, and the suggesting of 
>> making the `initted` field volatile cannot prevent concurrent initialization 
>> either; however, having `initted == true` published without the other 
>> fields' values is a possibility, which this patch addresses.
>> 
>> This simulates what's done in `CallSite`'s constructor for 
>> `ConstantCallSite`. Please feel free to point out the problems with this 
>> patch, as I am relatively inexperienced in this field of fences and there 
>> are relatively less available documents. (Thanks to 
>> https://shipilev.net/blog/2014/on-the-fence-with-dependencies/)
>
> liach has updated the pull request incrementally with two additional commits 
> since the last revision:
> 
>  - The fast path should always come first. good lesson learned!
>    restore config field comments
>  - Try making the config a record and see if it works

mandy, does this patch look good? i added a comment to warn about indy for 
records so as to avoid future unintended problems, while the current setup 
looks safe.

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

PR: https://git.openjdk.java.net/jdk/pull/6889

Reply via email to