News for hackers. Stuff that matters.
Re:Removal of Unsafe in Java 9 – A disaster in the making by carsongross on Monday July 13, 2015 @11:21AM (#9878649)
Once again, The Platonic Engineer gazes hatefully at the gronky, ugly and awkward things that make things work in real life, rub his hands together and says...

"Burn it to the ground."

Re:Removal of Unsafe in Java 9 – A disaster in the making by ScottBurson on Monday July 13, 2015 @04:09PM (#9880704)
Yeah, I don't get it either. Even the Lisp Machines had unsafe subprimitives you could call if you needed to and knew what you were doing.
Re:Removal of Unsafe in Java 9 – A disaster in the making by xg15 on Monday July 13, 2015 @11:37AM (#9878786)
Or you could actually stop for a second and find out why your current model needs so many ugly and awkward workarounds and try to adjust it accordingly - which seems to be what Oracle is trying to do in the long term.
Re:Removal of Unsafe in Java 9 – A disaster in the making by taeric on Monday July 13, 2015 @11:49AM (#9878861)
This is an odd one, though. I can not remember seeing/hearing any real issues with Unsafe. For the most part, people don't use it. There are a few that do, to ridiculous benefit. As things stand right now, without it, you can not get anything close to the performance people are seeing with it.

So, what many of us are seeing here is someone is upset with basically the shape of an API. They have no evidence that I have seen of trouble caused by it. Only a desire that such things not exist. This feels almost puritanical in how it is being exercised. Which is just plain silly for a technical debate.

Re:Removal of Unsafe in Java 9 – A disaster in the making by carsongross on Monday July 13, 2015 @12:14PM (#9879036)
puritanical

I think the correct term is platonic: each of us has an Inner Platonic Engineer who cannot abide the ugliness of real world systems and insist on The Great Rewrite. A lot of progress relies on that engineer.

However, in large, functioning and mature software systems he becomes the enemy.

Re:Removal of Unsafe in Java 9 – A disaster in the making by taeric on Monday July 13, 2015 @02:20PM (#9879930)
I question just how much progress relies on that engineer. Be honest here, there are no identified problems that are being solved here. Merely an undesirable in the system that is very effective at its job.

Progress, on other hand, advances something in the way of the problem space. Not merely rearranges something in the solution space.

Re:Removal of Unsafe in Java 9 – A disaster in the making by carsongross on Monday July 13, 2015 @12:10PM (#9878993)
But a new model should be that: a new model, not a suicide pact. Wise engineers keep the old API working while offering the new API (which, soon enough, will acquire its own gronkiness.) See the x86 and OS9/OSX evolutions, for example.

Thinking about the domain problem in the abstract is smart. Thinking about the current system in practical terms is wise.

Re:Removal of Unsafe in Java 9 – A disaster in the making by geofft on Monday July 13, 2015 @12:42PM (#9879225)
Java 8 is still around, and will be around for long enough. It's the Classic to your Cocoa, and the analogy works well: you need a full, separate virtual machine, because the software could be doing unsafe things with memory that you don't want to affect modern apps, but that VM will be around for a few years.

The equivalent of Carbon in this analogy is software written to documented APIs, which will run on both Java <= 8 and Java 9.

Re:Removal of Unsafe in Java 9 – A disaster in the making by justthistime_ on Monday July 13, 2015 @01:15PM (#9879466)
Java 8 support will run out in a while.

I'm pretty sure it won't "be around for long enough" except if you decide to stay on unmaintained versions full of unfixed security issues.

Re:Removal of Unsafe in Java 9 – A disaster in the making by geofft on Monday July 13, 2015 @01:22PM (#9879508)
It'll run out by September 2017, if not later:

http://www.oracle.com/technetwork/java/eol-135779.html

Do we believe that the affected software will not be able to move to the replacement APIs in the next two years? Honestly I'd expect that by fall 2017, the only versions of Cassandra, Spark, etc. that need sun.misc.Unsafe will themselves be unmaintained and full of unfixed security issues.

Re:Removal of Unsafe in Java 9 – A disaster in the making by joshstrange on Monday July 13, 2015 @02:13PM (#9879882)
Herein lies the problem. As other commenters have pointed out there is no alternative way to do thing performantly without Unsafe. These "core" (as in used everywhere not core to java) libraries don't use Unsafe for fun but often because there is no other way to do something without compromising way too much on speed or other things. If Java 9 had replacements for Unsafe things it would be one things but it doesn't.
Re:Removal of Unsafe in Java 9 – A disaster in the making by pjmlp on Monday July 13, 2015 @02:30PM (#9880003)
JNI
Re:Removal of Unsafe in Java 9 – A disaster in the making by colin_mccabe on Monday July 13, 2015 @09:52PM (#9882375)
JNI has a very high per-call overhead. It is not an effective alternative to many things in Unsafe. For example, in Hadoop when using short-circuit local reads, the client determines if the file descriptor it has cached is still valid by doing a read from a memory-mapped file. The only way to do this with decent performance is with Unsafe#getLongVolatile. In contrast, JNI methods can't be inlined, often require copying memory back and forth, and don't work well with the just-in-time compiler.

In many cases, the overhead of JNI is too large to even use it, unless you move a large portion of the program out of Java. If Oracle goes through with this removal it will be a huge problem for Java and the JVM ecosystem.