Package com.google.gson.internal
Class UnsafeAllocator
- java.lang.Object
-
- com.google.gson.internal.UnsafeAllocator
-
public abstract class UnsafeAllocator extends java.lang.Object
Do sneaky things to allocate objects without invoking their constructors.
-
-
Field Summary
Fields Modifier and Type Field Description static UnsafeAllocator
INSTANCE
-
Constructor Summary
Constructors Constructor Description UnsafeAllocator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static void
assertInstantiable(java.lang.Class<?> c)
Asserts that the class is instantiable.private static UnsafeAllocator
create()
abstract <T> T
newInstance(java.lang.Class<T> c)
-
-
-
Field Detail
-
INSTANCE
public static final UnsafeAllocator INSTANCE
-
-
Method Detail
-
newInstance
public abstract <T> T newInstance(java.lang.Class<T> c) throws java.lang.Exception
- Throws:
java.lang.Exception
-
assertInstantiable
private static void assertInstantiable(java.lang.Class<?> c)
Asserts that the class is instantiable. This check should have already occurred inConstructorConstructor
; this check here acts as safeguard since trying to use Unsafe for non-instantiable classes might crash the JVM on some devices.
-
create
private static UnsafeAllocator create()
-
-