11 ms·
Wrapping up Java 9 new Features
- mcherm 10y ago> underscore character is reserved. A variable can no longer be named only '_' Huh.... I wonder why that is?
- wodencafe 10y agoThey are going to use it to represent lambda parameters. Please see: http://openjdk.java.net/jeps/302 http://openjdk.java.net/jeps/302 - Lambda Leftovers
- mcherm 10y agoAh. Thanks.
- avmich 10y agoTo introduce pattern matching in the future?
- ww520 10y agoWildcard pattern? Wildcard variable? Dummy placeholder?
- buster 10y agoIs jigsaw being shipped or not? (relating to https://jaxenter.com/jigsaw-dispute-means-possible-delays-java-9-133723.html https://jaxenter.com/jigsaw-dispute-means-possible-delays-ja... )
- deleted 10y ago[deleted]
- bitmapbrother 10y agoYes, the objections by IBM and Red Hat won't stop this train.
- wodencafe 10y agoWhy didn't they just use OSGi, a stable, mature (16+ years old) technology for modularity, instead of re-inventing the wheel with JPMS?
- batter 10y agoi have used OSGI in projects and find it useful to see bundles states, Camel routes/endpoints, lot's of other useful stuff. But i have never seen it working properly in PROD enterprise application. Sadly my eclipse is just confirming that from time to time with errors :(
- jcadam 10y agoI know. OSGi needs to die. I'll quit a job before I subject myself to that level of pain and despair ever again.
- agumonkey 10y agoSorry for the easy jab, but is there anything from Eclipse that is good ? ps: user and ex plugin developer asking
- pjmlp 10y agoCDT used to be quite good, and there are some features like makefiles and debugging capabilities that are missing from CLion. And actually it does use less resources than either InteliJ or Android Studio, while having faster builds.
- Groxx 10y agoAndroid Studio's minimum-resource-usage-for-sane-performance is enormous. It does some things nicer than Eclipse, but there are definitely times I miss Eclipse's lean-ness, which is not a thing I would have expected myself to ever feel prior to AS.
- 10y ago
- bachmeier 10y agoI don't see anything in there about improving interoperability with native code. Years ago there were discussions of a project to do that. Maybe that is dead - perhaps everyone interested in native code interop has already moved on.
- vvanders 10y agoOr value types, which would remove some of the need for native code(yes yes, I know it's coming in Java 10 which means we'll see it in 2030 or so).
- AlphaSite 10y agoThat's project panama.
- pjmlp 10y agoIt is planned for Java 10. I bet Java 10 is probably going to be released earlier than ANSI C++ finally gets modules or concepts finalized.
- aethos 10y agoSimple, but I am most excited to see a REPL here -- JShell. I have written so so many Tester classes when I just wanted to run a few lines of java.
- revscat 10y agoI used the Groovy shell for this. Since Groovy is Java, you can paste Java code into the Groovy REPL and it works fine.
- vorg 10y ago> Since Groovy is Java, you can paste Java code into the Groovy REPL and it works fine Did you mean Java 7 and previous versions? You certainly can't paste Java 8 code into the Apache Groovy REPL if it has lambdas because Groovy hasn't been updated for Java 8, not to speak of the new features in Java 9. My guess is the sad state of the Groovy ecosystem is probably why Oracle even created JShell. In fact, you can't even paste Java 7 code in there and have it behave the same because of lots of little incompatibilities like the meaning of the == operator. Every Java developer should know never to paste Java code into a Groovy REPL and rely on the result for testing purposes. Groovy isn't Java. Like Java, Groovy generates JVM code, though it typically runs slower than Java code because Groovy is a dynamically-typed language. Although it added annotations for static typing into Groovy 2, they don't work for bulk code, only isolated test cases, and the latest versions of Groovy are still written in Java, not statically-annotated Groovy.
- libria 10y agoThere is a http://jpad.io/ http://jpad.io/ which was probably modeled after .NET's LINQpad.
- linkmotif 10y agoAll of this is super cool but what I really want is async/await. Every day I wish I had it. I know everyone has some pet thing they want, but I can't imagine async/await being nothing short of a game changer for Java. Why is it never mentioned? Will it ever happen?
- sreque 10y agoI can only guess, but it is in general very difficult to retrofit what is essentially green threading, coroutines, and continuations into a runtime that was built without those features. Scala has tried at least a couple of times, and as is typical of the language and community, has come up short as the original contributors lost interest or decided the problem was too hard. This includes: * Scala's CPS compiler plugin, now deprecated and unmaintained. * Macro-based async/await library. It's neat but has many more limitations than C#'s equivalent or Kotlin's, and hasn't had any updates in a couple of yaers. It looks like Kotlin has recently added experimental support for async/await. That language may be your best bet for now if you want to code in this style on the JVM.
- bitmapbrother 10y agoKotlin supports coroutines/async/await so I'm not sure why you think it would be so difficult to add it to Java.
- fgonzag 10y agoAnd it's actually a library, so it should be portable to java
- tormeh 10y agoWhat's the difference between async/await and a future? I've only used futures, but async/await looks like exactly the same thing: You're forking a thread (green or otherwise) to do some stuff and to set a flag of some sort when it's done so you can check on it. Right?
- 10y ago
- kleff 10y agoHas there been any hints of adding default parameters to Java at some point? It's one of those things I find really useful in Python or C#, but for some reason never seems to find its way into Java.
- wodencafe 10y agoI second this. Java needs default parameter values.
- pwaivers 10y agoI am a C# developer. My thoughts: - I love that they are adding REPL. I really wish C# had this. I use IPython all the time for Python. It is very helpful to mock something up quickly or try out different features. - Adding private methods to an interface seems very wrong to me. An interface is just a contract without any implementation at all. I am not sure the reason behind this. Aren't abstract classes a thing in Java? - I was sad to see that they have not included type inference to Java yet. It is just a syntax thing, but it makes writing code feel so much less wordy. Here's an open JEP for it: http://openjdk.java.net/jeps/286 http://openjdk.java.net/jeps/286
- josteink 10y ago> - I love that they are adding REPL. I really wish C# had this Here you go :) https://github.com/dotnet/roslyn/wiki/C%23-Interactive-Walkthrough https://github.com/dotnet/roslyn/wiki/C%23-Interactive-Walkt... Also: csi.exe. Try it :)
- pents90 10y agoAs a long-time Java developer, I really hope they won't implement JEP 286. I think type inference by the compiler is a bad idea, as it results in less readable code, more bugs, and an unnecessary burden on the compiler. I think all the examples where type inference is convenient are trivial cases, but the downsides start to crop up in real-world, large code bases. So it's something that makes the easy things slightly easier and the hard the things harder. Type inference already happens for you when you are using a good IDE, like IntelliJ IDEA. You can just use the "Introduce Variable" refactoring. And better yet, it self-documents your code with the variable's type.
- deleted 10y ago[deleted]
- saosebastiao 10y agoI think you're suffering from Stockholm syndrome. I have never experienced a bug using scala's type inference that could have been prevented by more required boilerplate. Type inference is 100% benefit with zero drawback. If you really want to know what a type is resolved to, you have both compilers and IDEs there to tell you. Relying on an IDE to write code is just hacking over a weak or broken language.
- leastangle 10y agoOne additional thing which is missing in the post is that AES-GCM is (finally!!) becoming usable: http://openjdk.java.net/jeps/246 http://openjdk.java.net/jeps/246 > performance increase is large compared to JDK 8 GA, ranging from 34x to 150x
- sea6ear 10y agoList<String> list = new ArrayList<>(){ };
- ucho 10y agoYeah, worst example ever. They should make it harder to make inner anonymous classes, not easier. When such code is used inside JEE/CDI/Spring Beans it leads to some annoying leaks or issues with serialization.
- joshmarinacci 10y agoDeath of the Applet. Yay! Finally.
- needusername 10y agoThe HTTP/2 client is incubator only [1]. Strictly speaking it's not part of Java 9. But that's not a big deal because ALPN is part of Java 9 so you can use 3rd party clients. [1] http://openjdk.java.net/jeps/110 http://openjdk.java.net/jeps/110