The code in the constructor will never be executed and parameters do not have to be known. This is the same method used by the internals of standard Java serialization, but relies on internal code (sun.misc.Unsafe) that may not be present on all JVMs.
The implementation will use standard Java functionality to write any fields. This requires Java 5 as minimum runtime and is used as fallback on platforms that do not provide the complete implementation level for the internals (like Dalvik).
| Modifier and Type | Field and Description |
|---|---|
| protected static final Exception | |
| protected static final Unsafe |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | newInstance(Class<T>
the type to instantiate type)Overrides com. Implements com. |
| private Object | |
| protected void |
| exception | back to summary |
|---|---|
| protected static final Exception exception | |
| unsafe | back to summary |
|---|---|
| protected static final Unsafe unsafe | |
| SunLimitedUnsafeReflectionProvider | back to summary |
|---|---|
public SunLimitedUnsafeReflectionProvider()
| |
| SunLimitedUnsafeReflectionProvider | back to summary |
|---|---|
public SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary)
| |
| newInstance | back to summary |
|---|---|
| public Object newInstance(Class<T> type) Overrides com. Implements com. Doc from com. Creates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created. | |
| readResolve | back to summary |
|---|---|
| private Object readResolve() Hides com. | |
| validateFieldAccess | back to summary |
|---|---|
| protected void validateFieldAccess(Field field) Overrides com. | |