Review Request: JDK-8235521: Replacement API for Unsafe::ensureClassInitialized
mark.reinhold at oracle.com
mark.reinhold at oracle.com
Thu Jun 4 19:39:24 UTC 2020
2020/6/3 19:31:13 -0700, mandy.chung at oracle.com:
> On 6/3/20 5:16 PM, Paul Sandoz wrote:
>> Did you consider an alternative name, such as:
>>
>> /**
>> * Initializes {@code targetClass}, if not already initialized.
>> * ...
>> */
>> public Class<?> initializeClass(Class<?> targetClass) ...
>>
>> ?
>
> I considered this. The targetClass may have been initialized.
> `initializeClass` seems to be read that it should check if it's
> initialized before calling?? I also considered `ensureInitialized`
> which can be an option. I'm open to suggestion.
I agree that the `ensure` prefix is useful here.
This method can only ensure that a class is initialized, so including
`Class` in the method name seems redundant. I’d go with the shorter
`ensureInitialized`.
- Mark
More information about the core-libs-dev
mailing list