On Jun 2, 2021, at 7:57 AM, Brian Goetz <brian.go...@oracle.com> wrote:
> 
> A minor bikeshed comment: We're asking users to change their `new Object()` 
> to `IdentityObject.newIdentity()`, and they may ask "why do I have to say 
> 'Identity' twice"?  (And by ask, I mean grumble, because we're already asking 
> them to change their working code.)
> 
> After a few minutes of thought, I think it might be a better fit to put this 
> at Objects::newIdentity.  The methods in Objects are conveniences that users 
> could write themselves, which this basically is -- there's nothing special 
> about this method, other than having a preferred alternative to `new 
> Object()` which users will understand.  So parking this where the Object 
> conveniences go seems slightly lower friction.

I think this is OK.

As a stretch move, I think we can even retro-upgrade
the type checking of Objects::newIdentity with type
variable trickery, when IdentityObject becomes real.

Please see:

https://bugs.openjdk.java.net/secure/attachment/95170/Foo.java
https://bugs.openjdk.java.net/browse/JDK-8268919

— John

Reply via email to