Skip to content

Instantly share code, notes, and snippets.

@ramn
Created November 20, 2014 22:02
Show Gist options
  • Save ramn/a4521ae53d3fc3e1b466 to your computer and use it in GitHub Desktop.
Save ramn/a4521ae53d3fc3e1b466 to your computer and use it in GitHub Desktop.
sun.misc.Unsafe use in Scala
def getUnsafeInstance: sun.misc.Unsafe = {
val f = classOf[sun.misc.Unsafe].getDeclaredField("theUnsafe")
f.setAccessible(true)
val unsafe = f.get(null).asInstanceOf[sun.misc.Unsafe]
unsafe
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment