Review Request: JDK-8235521: Replacement API for Unsafe::ensureClassInitialized

Paul Sandoz paul.sandoz at oracle.com
Thu Jun 4 19:00:01 UTC 2020



> On Jun 4, 2020, at 11:43 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 04/06/2020 17:55, Paul Sandoz wrote:
>> :
>> FWIW I keep tripping over the prefix “ensures”.  As I understand the implementation initializes a class, if not already so (and it has to check as you point out below). Focusing on the main action seems appropriate in this regard. I expect John has more context on the naming.
>> 
> One thing to mention is that some of the java.util classes have ensureCapacity methods, also have an EnsureXXX methods in JNI to ensure capacity. I've used ensureXXX in a few places to ensure that something is done before going further.

I see, thanks, that helps. 

If I view it as a (side-effecting) constraint before proceeding, then I think I get it, I was not thinking like that and was more focused on the action itself.


> Is it that this ensure method returns the Class rather than void?
> 

No. I was just seeing it from a different perspective.

I withdraw my naming suggestion!

Paul.


More information about the core-libs-dev mailing list