9 comments

[ 2.4 ms ] story [ 26.7 ms ] thread
You know what is unsafe? Installing java. Whether it is applet attacks on the client, timezone attacks on the server, it is just a gaping big glory hole on the computer ready for other people to insert their bits (of code) to exploit for fun and profit. Friends don't let friends install java. The biggest shame is that the apache project keeps pushing so much crappy java code out there, that this dinosaur persists.
Is this doc editable ? someone deleted the contents :-( Better to pdf it.
(comment deleted)
Or just change permission to "anyone with link can...">View
I'm very disappointed with Oracle's decision to remove Unsafe. What are they trying to accomplish? They aren't serving anyone by removing it. Who benefits from its removal? What actual user of the JVM or customer of Oracle has ever said "I really like this 10x performance increase from this library that uses Unsafe, but I can't sleep at night thinking my program could seg-fault at any time if something went wrong! Please get rid of Unsafe Oracle! I promise to buy 10x more hardware from you to make up for the difference!"

Java's "write once run anywhere at all costs" philosophy, combined with "be safe at all costs", have kept the JVM locked into server-side Linux applications for a long time, while C# has continued to expand in areas like the mobile space. If it weren't for Java being propped up by Google, Java would hardly exist in the mobile world at all.

C# + the CLR has world class native code integration and escape hatches to drop to unsafe code when performance matters. Java's native integration is absolutely terrible, but at least it had Unsafe, which provided a pragmatic tool for achieving excellent performance on the JVM in a number of scenarios.

Now, look at this comment from an Oracle employee: http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-Apri...

"Let me be blunt -- sun.misc.Unsafe must die in a fire. It is -- wait for it -- Unsafe. It must go..."

That's some very strong language backed by a simple, ridiculous reason; it's "unsafe". I honestly hope this Oracle employee's ideas die in a fire because they are out of touch with the needs of actual Java programmers, but my hope for that is slim at this point.

Did it occur to you at anytime that they might have a replacement for unsafe in the works? I don't get why you think it's so unreasonable for them to replace something they consider "unsafe" with alternate solutions that do they same thing but in a proper and supported manner.

BTW, Java will also get that "world class native code integration" with Project Panama.

(comment deleted)
This would be a terrible move and will retard the uptake of Java 9. Why not leave it as it is or just repackage it until replacements snake their way through the JSR process and then users can migrate their source.

Java will never bridge the performance gap with C/C++/etc. until it plays nice with modern architectures where being memory cache friendly is vital for performance. Unsafe has been shown to allow orders of magnitude speed improvements for certain tasks.

While I am on the subject could someone explain the point of Jigsaw? It will deliver nothing to current users and why bother with a cutdown Java on small devices these days when the cheapest phone has more power than desktops of 10 years ago? It seems to have consumed enormous resources and caused delays while Java is slipping further behind C# and other modern languages.

Perhaps they have something in mind to replace unsafe? Project Valhalla seems to address a lot of the reasons why people use unsafe.

http://www.oracle.com/technetwork/java/jvmls2014taylorrose-2... (Page 40)

There is also PackedObject from IBM. It's an experimental feature in their J9 JVM and it allows improved serialization and I/O of Java objects by allowing direct access to native/off heap data.

https://www.ibm.com/developerworks/community/forums/ajax/dow...

With the introduction of Valhalla, PackedObject and other technologies I think we'll see the performance gap decrease quite a bit.