Package com.google.gson.internal.reflect
Class UnsafeReflectionAccessor
- java.lang.Object
-
- com.google.gson.internal.reflect.ReflectionAccessor
-
- com.google.gson.internal.reflect.UnsafeReflectionAccessor
-
final class UnsafeReflectionAccessor extends ReflectionAccessor
An implementation ofReflectionAccessor
based onUnsafe
.NOTE: This implementation is designed for Java 9. Although it should work with earlier Java releases, it is better to use
PreJava9ReflectionAccessor
for them.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Field
overrideField
private java.lang.Object
theUnsafe
private static java.lang.Class
unsafeClass
-
Constructor Summary
Constructors Constructor Description UnsafeReflectionAccessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.reflect.Field
getOverrideField()
private static java.lang.Object
getUnsafeInstance()
void
makeAccessible(java.lang.reflect.AccessibleObject ao)
Does the same asao.setAccessible(true)
, but never throwsInaccessibleObjectException
(package private) boolean
makeAccessibleWithUnsafe(java.lang.reflect.AccessibleObject ao)
-
Methods inherited from class com.google.gson.internal.reflect.ReflectionAccessor
getInstance
-
-
-
-
Method Detail
-
makeAccessible
public void makeAccessible(java.lang.reflect.AccessibleObject ao)
Does the same asao.setAccessible(true)
, but never throwsInaccessibleObjectException
- Specified by:
makeAccessible
in classReflectionAccessor
-
makeAccessibleWithUnsafe
boolean makeAccessibleWithUnsafe(java.lang.reflect.AccessibleObject ao)
-
getUnsafeInstance
private static java.lang.Object getUnsafeInstance()
-
getOverrideField
private static java.lang.reflect.Field getOverrideField()
-
-