RFR: 8261407: ReflectionFactory.checkInitted() is not thread-safe [v7]

Mandy Chung mchung at openjdk.java.net
Mon Feb 14 17:27:12 UTC 2022


On Mon, 14 Feb 2022 08:01:38 GMT, Peter Levart <plevart at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 620:
>> 
>>> 618:      * The configurations exist as an object to avoid race conditions.
>>> 619:      * See bug 8261407. The object methods backed by indy may not be available.
>>> 620:      */
>> 
>> This comment is a bit unclear.   With the suggestion of moving the static `ReflectionFactory::config()` method and the comment I suggest below, I think that should be adequate to understand.  If not, we should improve the comment rather than relying on the readers to read the bug report.
>> 
>> Maybe the comment can be:
>> 
>> Configuration for core reflection which is configurable via system properties.
>> The user-configured settings are not available during early VM startup.
>> 
>> Note that the object methods of this Config record are called via indy which is 
>> available to use after initPhase1.   We can workaround that limitation by
>> implementing the object methods.
>
>> Note that the object methods of this Config record are called via indy which is 
>> available to use after initPhase1.   We can workaround that limitation by
>> implementing the object methods.
> 
> "Note that the object methods of this Config record are called via indy" is not very precise. They are called as any other method AFAIU. It's their implementation that uses indy, right? So perhaps, a better wording:
> 
> "Note that synthetic object methods of this Config record (toString, equals, hashCode) use indy in their implementation which is available to use after initPhase1.  These methods are currently not used, but should they be needed, a workaround is to explicitly (re)implement them."

"uses indy" is the right description.   Minor tweak:  s/synthetic/the default implementation of/

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

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


More information about the core-libs-dev mailing list