Top Description Fields Constructors Methods
com.google.gson.internal

public abstract Class UnsafeAllocator

extends Object
Class Inheritance
Imports
java.io.ObjectInputStream, .ObjectStreamClass, java.lang.reflect.Field, .Method

Do sneaky things to allocate objects without invoking their constructors.
Authors
Joel Leitch, Jesse Wilson

Field Summary

Modifier and TypeField and Description
public static final UnsafeAllocator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
assertInstantiable(Class<?> c)

Asserts that the class is instantiable.

private static UnsafeAllocator
public abstract <T> T
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final UnsafeAllocator INSTANCE

Constructor Detail

UnsafeAllocatorback to summary
public UnsafeAllocator()

Method Detail

assertInstantiableback to summary
private static void assertInstantiable(Class<?> c)

Asserts that the class is instantiable. This check should have already occurred in ConstructorConstructor; this check here acts as safeguard since trying to use Unsafe for non-instantiable classes might crash the JVM on some devices.

createback to summary
private static UnsafeAllocator create()
newInstanceback to summary
public abstract <T> T newInstance(Class<T> c) throws Exception