mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
speedup
This commit is contained in:
@@ -35,14 +35,16 @@ import java.lang.reflect.Modifier;
|
||||
* - new methods "forFieldXXX" added that search by field type instead of field name, which is useful in scrambled classes
|
||||
*/
|
||||
public class AtomicFieldUpdater<T,V> {
|
||||
private static final Unsafe unsafe = getUnsafe();
|
||||
|
||||
@NotNull
|
||||
public static Unsafe getUnsafe() {
|
||||
Unsafe unsafe = ReflectionUtil.getStaticFieldValue(Unsafe.class, Unsafe.class, "theUnsafe");
|
||||
private static final Unsafe unsafe;
|
||||
static {
|
||||
unsafe = ReflectionUtil.getStaticFieldValue(Unsafe.class, Unsafe.class, "theUnsafe");
|
||||
if (unsafe == null) {
|
||||
throw new RuntimeException("Could not find 'theUnsafe' field in the " + Unsafe.class);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Unsafe getUnsafe() {
|
||||
return unsafe;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user