JEP proposed to target JDK 12: 325: Switch Expressions (Preview) (original) (raw)

Joseph D. Darcy joe.darcy at oracle.com
Wed Aug 29 00:55:24 UTC 2018


Hello,

On 8/28/2018 5:21 PM, Brian Goetz wrote:

I think there's a lot of misunderstanding about what Preview is, and is for, floating around.

A Preview language feature still needs to be Done, to the same level of Done, as a permanent feature. The difference is that we have a (short) "grace period" where we have a chance to correct serious errors that have leaked past the usual process, without having to pay the Incompatibility Penalty. With our new cadence, I expect that most non-trivial language features will go through the Preview mechanism going forward. This does not mean they are experimental, or of lower quality, or have had less thought put into them. But, it does sometimes happen that we discover unexpected interactions only after things have been tried by a broader audience, and for this, Preview gives us a short window to correct such issues if they are found early enough.

[snip]

I'll again [1] offer an example of the benefit of having a grace period of some sort for developing language changes. Back during Project Coin, the initial production-ready, well-tested, and fully-spec'ed implementation of try-with-resources threw a NullPointerException if the resource being managed was null. Five months after builds with this implementation were available, we received compelling feedback that it would be better for the try-with-resources statement to ignore a null resource.

We consciously considered what to do about nulls at the beginning, but in response to feedback from experience using the feature, we changed our minds. The release schedule of JDK 7 accommodated changing the null handing, but we would have preferred the feedback sooner of course. If we had received the feedback a few months later than we did, we would have faced the unattractive choice of keeping a suboptimal design or breaking behavioral compatibility of a language feature.

Under the new six month release cadence, the preview language feature mechanism both provides additional time for developers to provide feedback and for the language development team to act on it.

-Joe

[1] http://mail.openjdk.java.net/pipermail/jdk-dev/2018-January/000547.html



More information about the jdk-dev mailing list