Safely Shoot Yourself in the Foot with Java 9

Grote Zaal

15:45 - 16:35

Java language

So what work do you do?” “Um, computers.” “Oh nice, what exactly?” “Well, I code Java”. And then: “Actually, I have a question about that. My PC says I must update Java …”

Two decades ago, the world gasped as an applet moved pixels on a web page. Dynamic content on the World Wide Wait! We were hooked. “And it’s 100% secure!”

Java 9 finally keeps the promise of “… it’s 100% secure!” by removing Unsafe, deep reflection on system classes, etc. All those lovely toys to peek and poke into native memory … they’re gone.

Well, not entirely. We can still do almost anything from Java 8. We can change Strings using deep reflection, Unsafe or even VarHandles. We can throw checked exceptions as unchecked. We can mark fields as @Contended. But this needs special privileges to work. It won’t work in Java 10. Promise. (We’ll see)

This talk will show you how to use some of the new Java 9 features, such as VarHandles, jshell and Stream improvements. We explain why you need to move over to G1 soon. We show how you can do all the old Java nasties, such as deep reflection into java.lang and throwing asynchronous exceptions.