RFR: 8261407: ReflectionFactory.checkInitted() is not thread-safe [v5]
liach
duke at openjdk.java.net
Thu Feb 10 22:25:15 UTC 2022
On Thu, 10 Feb 2022 19:45:24 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> liach has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>>
>> - use peter's model of separate data object
>> - Merge branch 'master' into 8261407-reflectionfactory
>> - Include the stable annotation
>> - Merge branch 'master' into 8261407-reflectionfactory
>> - Merge branch '8261407-reflectionfactory'
>> - Just use volatile directly to ensure read order
>> - 8261407: ReflectionFactory.checkInitted() is not thread-safe
>
> src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 672:
>
>> 670: private final boolean disableSerialConstructorChecks;
>> 671:
>> 672: private Config(boolean getProperties) {
>
> I suggest to make this a static `Config.getInstance()` method to return a `Config` instance and that should assert if this is called after the module system is initialized. The `Config` constructor is a simple constructor taking one parameter for each field and just set all fields to the parameter value.
Can I just write the config class as a record, or does it generate too much boilerplate?
-------------
PR: https://git.openjdk.java.net/jdk/pull/6889
More information about the core-libs-dev
mailing list