enhanced enums - back from the dead?

Kevin Bourrillion kevinb at google.com
Wed Dec 5 19:51:18 UTC 2018

Liam reminded me,

3. the upper bound for class literals, which maybe went without saying, but
there it is. Also harmless if I am correct that doing anything with the
result of `newInstance` etc. always results in one kind of warning or

Sorry, this is pointless to the real question you're asking, I just hate
saying something wrong without correcting it. :-)

On Wed, Dec 5, 2018 at 11:26 AM Kevin Bourrillion <kevinb at google.com> wrote:

> On Wed, Dec 5, 2018 at 8:19 AM Maurizio Cimadamore <
> maurizio.cimadamore at oracle.com> wrote:
> * Our proposed treatment for generic enums raises an additional, more
>> philosophical, question: what are raw types *for* and how happy are we
>> in seeing more of them (in the form of raw enum types)?
> I have looked high and low for valid use cases for raw types (apart from
> interacting with legacy code), and only ever found... two.
> 1. As the stepping stone to make a forbidden cast:
> @SuppressWarnings("unchecked") // safe because runtime type is
> functionally covariant
> Iterator<Object> objects = (Iterator) strings;
> A common use case for this is to interact with APIs that forgot their
> wlidcards, but there are plenty of other cases that can't be "fixed".
> 2. As the argument to instanceof. Everyone does it, of course, because
> writing out `instanceof Map<?, ?>` serves no purpose.
> Thankfully, they're both harmless... and I believe (?) they were even made
> exempt from "rawtypes" warnings. (If not, I'd opine that they should be.)
> --
> Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com

Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20181205/1c1cc62f/attachment.html>

More information about the amber-spec-experts mailing list