lundi 18 mai 2015

Why sun.misc.Unsafe#getUnsafe() can't be found using Java reflection?

Once I load the class sun.misc.Unsafe by reflection successfully, I can't found the getUnsafe method as a declared method using Java reflection. Why? I have no SecurityManager.

This is my code, which always throws NoSuchMethodException:

Class<?> c = Class.forName("sun.misc.Unsafe", false, getClass().getClassLoader());
Assert.assertNotNull(c.getDeclaredMethod("getUnsafe"));





Aucun commentaire:

Enregistrer un commentaire