You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static Unsafe getUnsafe() {
try {
return Unsafe.getUnsafe();
} catch (SecurityException se) {
try {
return java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Unsafe>() {
@Override
public Unsafe run() throws Exception {
final Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
if (true) {
final Field f = k.getDeclaredField("theUnsafe");
f.setAccessible(true);
final Object x = f.get(null);
return k.cast(x);
} else {
for (Field f : k.getDeclaredFields()) {
f.setAccessible(true);
final Object x = f.get(null);
if (k.isInstance(x))
return k.cast(x);
}
throw new NoSuchFieldError("the Unsafe");
}
}
});
} catch (java.security.PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics", e.getCause());
}
}
}
why would you use "if(true) .... else ..." in this method? do you forget to fill the expression of if?
The text was updated successfully, but these errors were encountered:
why would you use "if(true) .... else ..." in this method? do you forget to fill the expression of if?
The text was updated successfully, but these errors were encountered: