public class ReloadableType
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
byte[] |
bytesInitial
The bytes for the original implementation as first loaded, before rewriting
|
byte[] |
bytesLoaded
The bytes for the original implementation as first loaded, after rewriting
|
java.lang.String |
dottedtypename
The dotted typename
|
byte[] |
interfaceBytes
The bytes for the interface representing the first loaded implementation
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Invoker>> |
invokerCache_getDeclaredMethod |
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Invoker>> |
invokerCache_getMethod |
java.util.List<Invoker> |
invokersCache_getDeclaredMethods
Cache of the invokers used to answer getDeclaredMethods() call made on this type
|
java.util.Collection<Invoker> |
invokersCache_getMethods |
java.lang.ref.Reference<java.lang.reflect.Method[]> |
jlClassGetDeclaredMethods_cache |
java.lang.ref.Reference<java.lang.reflect.Method[]> |
jlClassGetMethods_cache |
static ReloadableType |
NOT_RELOADABLE_TYPE |
static java.lang.ref.WeakReference<ReloadableType> |
NOT_RELOADABLE_TYPE_REF |
java.lang.String |
slashedtypename
The slashed typename
|
TypeDescriptor |
typedescriptor
A type descriptor describing the shape of the type at first load
|
TypeRegistry |
typeRegistry
The registry maintaining this reloadable type
|
Constructor and Description |
---|
ReloadableType(java.lang.String dottedtypename,
byte[] initialBytes,
int id,
TypeRegistry typeRegistry,
TypeDescriptor typeDescriptor)
Construct a new ReloadableType with the specified name and the specified initial bytecode.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
cchanged(int ctorId) |
boolean |
cchanged(java.lang.String descriptor) |
int |
changed(int methodId)
Check if the specified method is different to the original form from the type as loaded.
|
void |
clearClassloaderLinks() |
int |
clinitchanged() |
__DynamicallyDispatchable |
determineDispatcher(java.lang.Object instance,
java.lang.String nameAndDescriptor)
Intended to handle dynamic dispatch.
|
java.lang.Object |
fetchLatest() |
java.lang.Object |
fetchLatestIfExists(int methodId) |
FieldMember |
findInstanceField(java.lang.String name)
Find the named instance field either on this reloadable type or on a reloadable supertype - it will not go into the
non-reloadable types.
|
FieldMember |
findStaticField(java.lang.String name)
Search for a static field from this type upwards, as far as the topmost reloadable types.
|
void |
fixupGroovyType()
Groovy types need some extra fixup:
they contain a callsite array that caches destinations for calls.
|
java.lang.String |
getBaseName() |
byte[] |
getBytesInitial() |
byte[] |
getBytesLoaded() |
java.lang.Class<?> |
getClazz() |
MethodMember |
getConstructor(java.lang.String descriptor) |
MethodMember |
getCurrentConstructor(java.lang.String desc) |
MethodMember |
getCurrentMethod(java.lang.String name,
java.lang.String descriptor)
Gets the method corresponding to given name and descriptor, taking into consideration changes that have happened by
reloading.
|
__DynamicallyDispatchable |
getDispatcher() |
java.lang.Object |
getField(java.lang.Object instance,
java.lang.String fieldname,
boolean isStatic)
Attempt to set the value of a field on an instance to the specified value.
|
FieldReaderWriter |
getFieldInHierarchy(java.lang.String name) |
MethodMember |
getFromLatestByDescriptor(java.lang.String nameAndDescriptor) |
int |
getId() |
byte[] |
getInterfaceBytes() |
JavaMethodCache |
getJavaMethodCache() |
byte[] |
getLatestDispatcherBytes() |
java.lang.Class<?> |
getLatestDispatcherClass() |
java.lang.Object |
getLatestDispatcherInstance() |
java.lang.Object |
getLatestDispatcherInstance(boolean b) |
java.lang.String |
getLatestDispatcherName() |
byte[] |
getLatestExecutorBytes() |
java.lang.Class<?> |
getLatestExecutorClass() |
java.lang.String |
getLatestExecutorName() |
TypeDescriptor |
getLatestTypeDescriptor() |
CurrentLiveVersion |
getLiveVersion() |
MethodMember |
getMethod(java.lang.String nameAndDescriptor) |
MethodMember |
getMethod(java.lang.String name,
java.lang.String descriptor)
Gets the 'orignal' method corresponding to given name and method descriptor.
|
java.lang.String |
getName() |
MethodMember |
getOriginalConstructor(java.lang.String desc) |
MethodMember |
getOriginalMethod(java.lang.String nameAndDescriptor)
Gets the method corresponding to given name and descriptor, from the original type descriptor.
|
java.lang.String |
getSlashedName() |
java.lang.String |
getSlashedSupertypeName() |
ReloadableType |
getSuperRtype() |
TypeDescriptor |
getTypeDescriptor() |
TypeRegistry |
getTypeRegistry() |
int |
getTypeRegistryId() |
boolean |
hasBeenReloaded() |
boolean |
hasFieldChangedInHierarchy(java.lang.String name) |
boolean |
hasStaticInitializer() |
boolean |
isResolved() |
boolean |
loadNewVersion(byte[] newbytedata) |
boolean |
loadNewVersion(java.lang.String versionsuffix,
byte[] newbytedata)
Load a new version of this type, using the specified suffix to tag the newly generated artifact class names.
|
boolean |
loadNewVersion(java.lang.String versionsuffix,
byte[] newbytedata,
boolean shouldRerunStaticInitializer) |
FieldReaderWriter |
locateField(java.lang.String name) |
void |
reloadMostRecentDispatcherAndExecutor() |
void |
rewriteCallSitesAndDefine()
Rewrite the code for this reloadable type.
|
void |
runStaticInitializer() |
void |
setField(java.lang.Object instance,
java.lang.String fieldname,
boolean isStatic,
java.lang.Object newValue)
Attempt to set the value of a field on an instance to the specified value.
|
void |
setResolved() |
void |
setSuperclass(java.lang.Class<?> superclazz) |
boolean |
simulateReload() |
java.lang.String |
toString() |
void |
trackLiveInstance(java.lang.Object instance) |
FieldReaderWriter |
walk(java.lang.String name,
TypeDescriptor typeDescriptor) |
public TypeRegistry typeRegistry
public final java.lang.String dottedtypename
public final java.lang.String slashedtypename
public byte[] bytesInitial
public byte[] bytesLoaded
public final byte[] interfaceBytes
public TypeDescriptor typedescriptor
public java.util.List<Invoker> invokersCache_getDeclaredMethods
public java.util.Collection<Invoker> invokersCache_getMethods
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Invoker>> invokerCache_getMethod
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Invoker>> invokerCache_getDeclaredMethod
public static final ReloadableType NOT_RELOADABLE_TYPE
public static final java.lang.ref.WeakReference<ReloadableType> NOT_RELOADABLE_TYPE_REF
public java.lang.ref.Reference<java.lang.reflect.Method[]> jlClassGetDeclaredMethods_cache
public java.lang.ref.Reference<java.lang.reflect.Method[]> jlClassGetMethods_cache
public ReloadableType(java.lang.String dottedtypename, byte[] initialBytes, int id, TypeRegistry typeRegistry, TypeDescriptor typeDescriptor)
dottedtypename
- the dotted nameinitialBytes
- the bytecode for the initial versionid
- for this reloadable type, allocated by the registrytypeRegistry
- the registry managing this typetypeDescriptor
- the type descriptor (if it has already been worked out), otherwise nullpublic java.lang.Class<?> getClazz()
public java.lang.String toString()
toString
in class java.lang.Object
public TypeDescriptor getTypeDescriptor()
public MethodMember getMethod(java.lang.String name, java.lang.String descriptor)
name
- method namedescriptor
- method descriptor (e.g (Ljava/lang/String;)I)public MethodMember getConstructor(java.lang.String descriptor)
public boolean loadNewVersion(byte[] newbytedata)
public boolean simulateReload()
public boolean loadNewVersion(java.lang.String versionsuffix, byte[] newbytedata, boolean shouldRerunStaticInitializer)
public boolean loadNewVersion(java.lang.String versionsuffix, byte[] newbytedata)
versionsuffix
- the String suffix to append to classnames being created for the reloaded classnewbytedata
- the class bytes for the new version of this classpublic void fixupGroovyType()
public byte[] getLatestDispatcherBytes()
public java.lang.Class<?> getLatestDispatcherClass()
public byte[] getInterfaceBytes()
public java.lang.Object getLatestDispatcherInstance()
public java.lang.Object getLatestDispatcherInstance(boolean b)
public java.lang.String getLatestDispatcherName()
public byte[] getBytesInitial()
public byte[] getBytesLoaded()
public byte[] getLatestExecutorBytes()
public java.lang.Class<?> getLatestExecutorClass()
public java.lang.String getLatestExecutorName()
public MethodMember getCurrentMethod(java.lang.String name, java.lang.String descriptor)
name
- the member namedescriptor
- the member descriptor (e.g. (Ljava/lang/String;)I)public MethodMember getOriginalMethod(java.lang.String nameAndDescriptor)
nameAndDescriptor
- the method name and descriptor (e.g. foo(Ljava/lang/String;)I)public java.lang.String getName()
public java.lang.String getSlashedName()
public TypeRegistry getTypeRegistry()
public int getTypeRegistryId()
public int getId()
public void rewriteCallSitesAndDefine()
public java.lang.Object fetchLatest()
public boolean hasBeenReloaded()
public CurrentLiveVersion getLiveVersion()
public boolean cchanged(java.lang.String descriptor)
public java.lang.Object cchanged(int ctorId)
public int changed(int methodId)
methodId
- the ID of the method currently executingpublic int clinitchanged()
public java.lang.Object fetchLatestIfExists(int methodId)
public java.lang.String getSlashedSupertypeName()
public __DynamicallyDispatchable getDispatcher()
public __DynamicallyDispatchable determineDispatcher(java.lang.Object instance, java.lang.String nameAndDescriptor)
instance
- the target instance for the invocationnameAndDescriptor
- an encoded method name and descriptor, e.g. foo(Ljava/langString;)Vpublic java.lang.String getBaseName()
public TypeDescriptor getLatestTypeDescriptor()
public MethodMember getFromLatestByDescriptor(java.lang.String nameAndDescriptor)
public MethodMember getMethod(java.lang.String nameAndDescriptor)
public MethodMember getCurrentConstructor(java.lang.String desc)
public MethodMember getOriginalConstructor(java.lang.String desc)
public JavaMethodCache getJavaMethodCache()
public FieldMember findInstanceField(java.lang.String name)
name
- the name of the field to locatepublic FieldMember findStaticField(java.lang.String name)
name
- the name of the field to look forpublic void setField(java.lang.Object instance, java.lang.String fieldname, boolean isStatic, java.lang.Object newValue) throws java.lang.IllegalAccessException
instance
- the object upon which to set the field (maybe null for static fields)fieldname
- the name of the fieldisStatic
- whether the field is staticnewValue
- the new value to put into the fieldjava.lang.IllegalAccessException
- if there is a problem setting the field valuepublic java.lang.Object getField(java.lang.Object instance, java.lang.String fieldname, boolean isStatic) throws java.lang.IllegalAccessException
instance
- the object upon which to set the field (maybe null for static fields)fieldname
- the name of the fieldisStatic
- whether the field is static or notjava.lang.IllegalAccessException
- if there is a problem accessing the fieldpublic FieldReaderWriter locateField(java.lang.String name)
public FieldReaderWriter walk(java.lang.String name, TypeDescriptor typeDescriptor)
public boolean hasFieldChangedInHierarchy(java.lang.String name)
public FieldReaderWriter getFieldInHierarchy(java.lang.String name)
public void clearClassloaderLinks()
public void reloadMostRecentDispatcherAndExecutor()
public void trackLiveInstance(java.lang.Object instance)
public void runStaticInitializer()
public boolean isResolved()
public void setResolved()
public void setSuperclass(java.lang.Class<?> superclazz)
public ReloadableType getSuperRtype()
public boolean hasStaticInitializer()