All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.thksystems.util.reflection.UnsafeUtils Maven / Gradle / Ivy

Go to download

Commons for lang, crypto, xml, dom, text, csv, reflection, annotations, parsing, ...

There is a newer version: 4.3.3
Show newest version
package de.thksystems.util.reflection;

import java.lang.reflect.Field;

import sun.misc.Unsafe;

/**
 * Access to the internal Unsafe class.
 * 

* Use it only, if you really, really, really, really, really know, what you are doing. *

* It may not work with all java implementations. */ @SuppressWarnings("restriction") public final class UnsafeUtils { private UnsafeUtils() { } /** * Gets the internal Unsafe class. */ public static Unsafe getUnsafe() { try { Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); unsafeField.setAccessible(true); return (Unsafe) unsafeField.get(null); } catch (IllegalAccessException | NoSuchFieldException | SecurityException e) { return null; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy