Locking on primitive boxes
brian.goetz at oracle.com
Wed Feb 19 20:32:59 UTC 2020
> First, note that all the wrappers have had static `valueOf()`
> factories, and the corresponding constructors have been deprecated
> since Java 9. It would be reasonable to deprecate these for
> removal at any time. (These would not actually be removed, but
> instead made private.)
> You can make them synthetic instead of private, so there will not be
> available at compile time but still exist at runtime.
That's a possible intermediate move (thought its not possible to express
this in source code currently), to support existing binaries while
providing stronger compile-time pushback.
> I still think it's a bit early, i would prefer to have reified
> generics before deciding how to retrofit primitive wrapper, i.e. if we
> can still have two different behavior, box and value, from the same class.
Waiting for specialized generics seems a bit extreme. I agree that
there is some uncertainty in the migration story for primitives to
inlines, and we of course want to nail that down ASAP, but we also don't
want to wait too long once we have our story straight, as the leads
times here are long.
More information about the valhalla-spec-observers