RFR: 8028816: Add value-type notice to Optional* classes

Brian Goetz brian.goetz at oracle.com
Thu Jan 23 18:16:31 UTC 2014

A future version of Java will hopefully have value types.  The disclaimers about "value-based" are intended as a stake in the ground, to preserve the option to migrate these specific new-to-Java-8 types to value types in the future.  (Older sort-of-valueish-like-but-not-quite types, like Integer, are a hopeless cause.)  When "value type" is a real thing, it will have linguistic support.  Until then, he best we can do is capture the design intent for specific library classes in their specification to preserve clarity and flexibility.

On Jan 23, 2014, at 11:13 AM, Paul Benedict wrote:

> Florian, it's an idea I also broached but did not receive any feedback:
> http://mail.openjdk.java.net/pipermail/lambda-libs-spec-observers/2013-December/002585.html
> The only downside to adding the annotation is that it makes it "the"
> official way to denote a value type. Based on some JEPs and Lambda
> mailings, I think there's some heavy discussions behind the scenes to
> explore this design space. I don't know if committing to an annotation
> at this point is the "right" solution.
> -- 
> Cheers,
> Paul
>> * There's been a discussion on the lambda spec experts list (http://mail.openjdk.java.net/pipermail/lambda-spec-experts/ <http://mail.openjdk.java.net/pipermail/lambda-spec-experts/>) about adding a notice to the Optional classes about implications of their likely future as values. This discussion recently completed so now there's a doc patch to review:
> *>>* http://cr.openjdk.java.net/~mduigou/JDK-8028816/0/webrev/
> <http://cr.openjdk.java.net/%7Emduigou/JDK-8028816/0/webrev/>
> *>>* I have already reviewed this but will hold off pushing it for a
> few hours in case someone notices a mistake that I did not.
> *
> Would it make sense to have an annotation (with class file retention) to
> express this?
> -- 
> Florian Weimer / Red Hat Product Security Team

More information about the core-libs-dev mailing list