This release has quite some impact - it has removed all JEE APIs like JAXB, JAF and RMI. CORBA is also gone. Furthermore, Nashorn is deprecated and will probably be dropped pretty soon.

FYI, I'm working on getting a new version of https://robtimus.github.io/whats-new-in-java/. The removal of entire packages has lead to some interesting behaviour, like features introduced in previous versions no longer showing up as new for those versions. I expect to have this fixed later this week.

I recently noticed that the Rhino JavaScript engine -Nashorn's predecessor- has once again become quite active. Since the future development of Nashorn seems uncertain, Rhino -which also implements the javax.script API- may be a replacement once Nashorn is gone.

I hadn't even noticed that. I guess they thought it's unnecessary with the search box at the right.

. . . . The removal of entire packages has lead to some interesting behaviour, like features introduced in previous versions no longer showing up as new for those versions. . . .

I presume old code still runs?

It depends. If you have code that uses JAXB or any of the other JEE modules, you need to explicitly get a replacement and include that in your project. The removal of (mostly old) deprecated methods could well break very old code that still use them.

It appears that the Java-11 JRE for Windows doesn't come with the JDK download. For "java -version" I still get my 10.0.2 version. Anybody have any ideas on this? I tried to find the JRE on Oracle's site but was unsuccessful.

I am getting 11, but on a Linux box. Surely your PATH is correct. There doesn't appear to be a JRE download link here any more. Is there anything on OpenJDK? No, there isn't. Can't help any more. Sorry.

Rob Spoor wrote:FYI, I'm working on getting a new version of https://robtimus.github.io/whats-new-in-java/. The removal of entire packages has lead to some interesting behaviour, like features introduced in previous versions no longer showing up as new for those versions. I expect to have this fixed later this week.

It's done (although no modules are displayed in the UI yet, only packages). There are some nice additions again (most of which gave me a "finally!" feeling):

* FileReader and FileWriter can take a Charset; no more new InputStreamReader(new FileInputStream(file), charset) but just newFileReader(file, charset).

Well, the implementation requirements section says this: "The default implementation calls the generator function with zero and then passes the resulting array to toArray(T[])."

So there's still toArray(T[]) involved, it's just that toArray(String[]::new) encapsulates the call to toArray(new String[0]). The method reference version is arguably less confusing to read, I guess.

If I had a collection of Book objects, would bookList.toArray(Book[]::new) be easier to read than bookList.toArray(new Book[0])? I don't know, can't decide for myself right now. Maybe it's because my brain is already used to the semantics of the toArray(new Book[0]) idiom. Maybe it's just a matter of getting used to a new idiom.

EDIT: Never mind. I'm used to it now -- just needed to read it out loud and hear myself try to explain it.

Interesting. I thought that they would create an array of the correct size. However, not even in ArrayList is the implementation overridden (yet). That class could definitely have benefited. For instance:

Right now there will a be a new zero-length array that will only be used to create the actual array. Heck, I would even have expected using toArray(generator.apply(size())) as default implementation. Only thread-safe implementations would need to override that.

Junilu Lacar wrote:If I had a collection of Book objects, would bookList.toArray(Book[]::new) be easier to read than bookList.toArray(new Book[0])?

With no doubts. new Book[0] is confusing as hell to me, because it gives an impression that it will create a 0 length array, and since we know arrays can't expand, it gives a feeling while Book[]::new suggests me that it will create an array of the needed size whatever that size might be, which in fact I don't need to know. That's how my brains interpret that.

when in doubt - just merge, and never rebase

All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad: