~/talk

Safely Shoot Yourself in the Foot with Java 9

Talkat Devoxx Belgium 2017 · 2017-11-06..11-10· [java]
slides:none on file

Java 9 replaces Unsafe-era hacks with VarHandles and method-handles lookups but shows exactly how to regain old powers using --add-opens/--add-exports, including poking a String’s internal byte[] (can't write finals directly, must copy bytes), accessing Thread.probe for LongAdder striping, forcing unmap of MappedByteBuffer via Cleaner/Unsafe, and patching BigInteger to expose a private square method; demos use jshell, note Stream methods (takeWhile/dropWhile) can break assumptions, and recommend migrating GC configs to G1 soon.

AI-written summary · about

  1. 0:00Introduction
  2. 0:52Project Jigsaw and security
  3. 3:35The unsafe class legacy
  4. 8:10Var handles in Java 9
  5. 10:50Concurrency and memory
  6. 15:40Modifying internal fields
  7. 20:42Java 9 JShell scripting
  8. 24:45Handling native memory
  9. 32:41Memory padding and contention
  10. 35:45Stream and GC changes
  11. 37:32Accessing private internals
  12. 44:06Hashing behavior puzzle
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.