// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.unsafe;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import com.hypixel.hytale.sneakythrow.SneakyThrow;
import javax.annotation.Nullable;
import sun.misc.Unsafe;

public class UnsafeUtil
{
    @Nullable
    public static final Unsafe UNSAFE;
    
    static {
        Unsafe instance;
        try {
            final Field field = Unsafe.class.getDeclaredField("theUnsafe");
            field.setAccessible(true);
            instance = (Unsafe)field.get(null);
        }
        catch (final Exception e1) {
            try {
                final Constructor<Unsafe> c = Unsafe.class.getDeclaredConstructor((Class<?>[])new Class[0]);
                c.setAccessible(true);
                instance = c.newInstance(new Object[0]);
            }
            catch (final Exception e2) {
                throw SneakyThrow.sneakyThrow(e2);
            }
        }
        UNSAFE = instance;
    }
}
