java.lang.Object
com.google.gson.internal.UnsafeAllocator
Do sneaky things to allocate objects without invoking their constructors.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
assertInstantiable
(Class<?> c) Asserts that the class is instantiable.private static UnsafeAllocator
create()
abstract <T> T
newInstance
(Class<T> c)
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
UnsafeAllocator
public UnsafeAllocator()
-
-
Method Details
-
newInstance
- Throws:
Exception
-
assertInstantiable
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
-