7 ms·
Since you have to read a long way through the FAQ to find out, here are the answers to the two most important questions I had: Q) So what works from Java 7?
by luke_s 13y ago
Since you have to read a long way through the FAQ to find out, here are the answers to the two most important questions I had:
Q) So what works from Java 7?
A) All the syntatic sugar stuff and also "try with resources." (see below)
1) String Switches
2) Try with resources (a.k.a "using/with", auto close)
3) Multiple exception caught in one catch block
4) Integer (and binary) literals for readability (e.g. 100_000_000 or 20_000 or 0b0111_0000)
5) Type inference on collections (a.k.a. "diamonds")
Q) What doesn't work?
1) java.nio.*
2) threading and multiple processor enhancements (fork/join)
3) File change notifications (watch/notify file api stuff)
4) invokedynamic
Its unfortunate that google haven't worked to bring more modern java language features to Android, although I imagine that the Android group has been kept rather busy with other things. Still, Google io is coming, with what is sure to be a slew of new product and feature announcements, so one can hope ...
- yareally 13y agoSorry about burying the most important questions. I moved them to the top of the FAQ now :) I really wish Google would just make amends with the Apache Foundation and work with them on improving OpenJDK. It would be so much better for both (and us developers) if they did. All the unimplemented stuff falls under more than a weekend project and not sure how nice some of it would play with Android's APIs and Dalvik. The only thing I would really love to see outside of what was able to easily get working is Lambdas.
- luke_s 13y agoI was following the goings on between the ASF and Sun/Oracle a while back, but I was un-aware that ASF and google also had problems! What was the nature of their disagreement? I think lambdas is the one killer feature I would love to see in Android/Java - particularly for a framework such as Androids which is so callback heavy, lambdas would be an immense help.
- yareally 13y agoIt's not really a feud thing, but they did go and use the now abandoned Apache Harmony code instead of just working with Apache on OpenJDK and working out an appropriate license for Java through them (and probably avoided the Oracle legal mess). I can't speak for either side, but I never pictured Apache as being overly happy about Google's choices in that situation. Someone who is more of an expert (as I'm not) on the events behind this can probably give a more accurate interpretation.
- koko775 13y agoOpenJDK has a field of use restriction; sublicensing it to remove the field of use restriction would have been illegal. Google would have had to license it from Oracle without the restriction. Given huge effort to implement Dalvik in such a way that the end result could not be called Java, they had to be able to make the argument that Dalvik was a cleanroom implementation of Java. They worked from open specifications; Java 6's specification was open-source, whereas Java 7+ was locked down. There is no Java 7 implementation that could be made without violating the license terms of the specification, as it was no longer open. It's also clear that they could never have worked with Apache, as any developers who had seen substantial Java 7 implementation code or the specification could be considered "contaminated", and thus any work on Dalvik or any other non-FOU-restricted JVM could be in violation of the license terms. Whether or not this would actually be true, it would be a huge, huge legal vulnerability. Google and Apache had to avoid each other out of legal necessity to ensure Dalvik's survival. Oracle v. Google could never have worked had they not implemented a very strict (and well-implemented, albeit slightly imperfect) isolation between "Android Java" and "Actual Java". Android technically can't (and doesn't) call what runs on Android devices "Java" - because it's not a compliant VM, they don't have the trademark to use it as such. That said, because of the process they use in which the code is compiled to Java bytecode before it's compiled to Dalvik bytecode, they can make reference to it in terms of the tools - just not in terms of Android actually running it.
- yareally 13y agoJust the answer I was hoping for. Thanks!