Created
November 20, 2014 22:02
-
-
Save ramn/a4521ae53d3fc3e1b466 to your computer and use it in GitHub Desktop.
sun.misc.Unsafe use in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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