A disclaimer or two for Optional
Joe Bowbeer
joe.bowbeer at gmail.com
Sat Nov 30 21:28:58 PST 2013
Is there something about this case that prohibits compiler warnings?
> It is not possible for the compiler to understand and enforce every
library-based invariant.
The compiler emits a lot of warnings about dubious code that should be
avoided. Why wouldn't you want the compiler to warn about this one? (It
seems like you're claiming that the compiler shouldn't warn about this.)
This is a case where the ill-advised code seemingly works, and for all
practical purposes it works. And yet it should be avoided because in Java
9 it will no longer work. Shouldn't the compiler warn about that if/when
it can?
On Sat, Nov 30, 2013 at 9:23 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>
> I'm just pointing out that this is a serious warning in the javadoc that
> certainly qualifies for javac integration as well (right?).
>
> No, wrong.
>
> This is like saying that library code can't have invariants that the
> compiler cannot enforce.
>
> The compiler is not in the business of detecting every possible violation
> of every possible classes spec. Nor has this disclaimer of what
> value-based means remotely risen to the level of language feature.
>
>
>
>>>>>
>>>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20131130/93dd1933/attachment.html
More information about the lambda-libs-spec-experts
mailing list