Friday Java Quiz: What's Your Favorite Java 7 Feature...
... That Didn't Make It In
Like in past years, I'm following JavaOne from afar. All I have access to are the general sessions and attendee's blog reactions to specific sessions on JavaLobby, java.net, JavaBlogs, and StuffThatHappens. And on Tuesday's session, I heard Danny Coward talking about new features for Java 7,
which, BTW, is scheduled for Summer of 2009.
This, I suppose, is the same talk as the one I mentioned 509 days ago. However, the scope has clearly shrunk quite a bit.
Today's quiz is a rhetorical one:
Q: What is your favorite new Java language feature that did not make it into Java 7?
I'll start with mine:
- XML literal (I'm virtually alone on this one, but still...)
- Properties (can anyone tell if it's in or not?)
- Reified types for Java generics (Erase Erasure, as I've call it 475 days ago)
Re: Friday Java Quiz: What's Your Favorite Java 7 Feature...
Wow!! Not even properties? That's really harsh man. I mean I can understand closures being a little controversial, but properties? Give me a break. For goodness sake we just got the module keyword added to the language, and no one said a peep. I think whoever is calling the shots on these is serving someone's interest, but surely not the Java language and its users.
So what's else do we expect to get: some stupid method extension stuff. Just because some big shot somewhere happens to be pushing for it.
Anyway, what's up with this sudden pessimism coming you Stephen of all people. You being a key player behind many of these features.
Re: Friday Java Quiz: What's Your Favorite Java 7 Feature...
For me, type erasure must be the most missed feature. I know the Collections.checkedCollection() attempts to fix this, but these are highly underused and a manual step many don't undertake.
Re: Friday Java Quiz: What's Your Favorite Java 7 Feature...
As much as I would like to complain about type erasure and would like to have Sun switch to or probably add reified Generics, I understand the motivation behind this "feature". Type erasure is now a part of Java that will never be taken out. It is also my opinion, that there will be no attempt to add reified Generics. So I'm settling on "Improved Type Inference" as my favorite Java 7 feature. I'm fed up with writing long-winded stuff like that:
Map<LongClassName, List<EvenLongerClassName>> map = new HashMap<LongClassName, List<EvenLongerClassName>>();
According to Neal Gafter (at a JavaPolis 2007 BOF) it would be more or less easily possible to change the way you declare generic types from the above to something like the following:
Map<LongClassName, List<EvenLongerClassName>> map = new HashMap<>();
I think that would make a great addition in terms of improving the ease-of-use of Java in certain areas.
Apart from type inference I'd like to see stuff like:
- Improved catch clauses (catch multiplpe exception types, rethrow checked exceptions).
- Multi-line strings.
- Some of the stuff Stephen Colebourne has been writing about lately such as for-each loops for Maps and List and Map literals.
Cheers, Martin