Package org.hotswap.agent.plugin.jvm
Class AnonymousClassInfos
- java.lang.Object
-
- org.hotswap.agent.plugin.jvm.AnonymousClassInfos
-
public class AnonymousClassInfos extends Object
Info about anonymous classes. This class will on construction search for all anonymous classes of the main class and calculate superclass, interfaces, all methods signature and all fields signature. Depending on used constructor this is done via reflection from ClassLoader (current loaded state) or from ClassPool via javaassist. Note that ClassPool uses LoadClassPath on the ClassLoader and hence are resources resolved via the ClassLoader. Javaasist resolves the resource and returns bytcode as is in the resource file. Use mapPreviousState() to create compatible transition mapping between old state and new state. This mapping is then used by plugin to swap class bytecoded to retain hotswap changes compatible- Author:
- Jiri Bubnik
-
-
Field Summary
Fields Modifier and Type Field Description static intUNIQUE_CLASS_START_INDEX
-
Constructor Summary
Constructors Constructor Description AnonymousClassInfos(ClassLoader classLoader, String className)Create info of the current state from the classloader via reflection.AnonymousClassInfos(ClassPool classPool, String className)Create info of the new state from the classPool via javassist.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnonymousClassInfogetAnonymousClassInfo(String className)Returns stored info of an anonymous classStringgetCompatibleTransition(String className)Find compatible transition class name.Map<AnonymousClassInfo,AnonymousClassInfo>getCompatibleTransitions()Returns calculated compatible transitions.booleanisCurrent(ClassPool classPool)Return true, if last modification timestamp is same as current timestamp of className.voidmapPreviousState(AnonymousClassInfos previousAnonymousClassInfos)Set previous class info state and calculate compatible transitions.
-
-
-
Field Detail
-
UNIQUE_CLASS_START_INDEX
public static final int UNIQUE_CLASS_START_INDEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AnonymousClassInfos
public AnonymousClassInfos(ClassLoader classLoader, String className)
Create info of the current state from the classloader via reflection.- Parameters:
classLoader- classloader to useclassName- main class
-
-
Method Detail
-
getAnonymousClassInfo
public AnonymousClassInfo getAnonymousClassInfo(String className)
Returns stored info of an anonymous class- Parameters:
className- class name of the anonymous class (Should be in the form of MyClass$3)- Returns:
- class info x null
-
mapPreviousState
public void mapPreviousState(AnonymousClassInfos previousAnonymousClassInfos)
Set previous class info state and calculate compatible transitions. Usually new state is created from classpool, while old state from classloader.- Parameters:
previousAnonymousClassInfos- previous state
-
isCurrent
public boolean isCurrent(ClassPool classPool)
Return true, if last modification timestamp is same as current timestamp of className.- Parameters:
classPool- classPool to check className file- Returns:
- true if is current
-
getCompatibleTransitions
public Map<AnonymousClassInfo,AnonymousClassInfo> getCompatibleTransitions()
Returns calculated compatible transitions.- Returns:
- calculated compatible transitions.
-
-