Package pascal.taie.language.classes
Class ClassHierarchyImpl
java.lang.Object
pascal.taie.language.classes.ClassHierarchyImpl
- All Implemented Interfaces:
Serializable
,ClassHierarchy
,Indexer<JClass>
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a JClass into class hierarchy.Dispatches a method reference on a receiver class.Dispatches a method reference on a receiver type.getAllSubclassesOf
(JClass jclass) Returns all subclasses of the given class (including itself).getClass
(JClassLoader loader, String name) getDirectImplementorsOf
(JClass jclass) getDirectInnerClassesOf
(JClass jclass) getDirectSubclassesOf
(JClass jclass) getDirectSubinterfacesOf
(JClass jclass) Obtains a field by its signature.int
getJREClass
(String name) Obtains a JRE class by it name.getJREField
(String fieldSig) Obtains a field declared in a JRE class by its signature.getJREMethod
(String methodSig) Obtains a method declared in a JRE class by its signature.Obtains a method by its signature.getObject
(int index) boolean
isSubclass
(JClass superclass, JClass subclass) resolveField
(FieldRef fieldRef) Resolves a field reference.resolveMethod
(MethodRef methodRef) Resolves a method reference.void
setBootstrapClassLoader
(JClassLoader loader) void
setDefaultClassLoader
(JClassLoader loader)
-
Constructor Details
-
ClassHierarchyImpl
public ClassHierarchyImpl()
-
-
Method Details
-
setDefaultClassLoader
- Specified by:
setDefaultClassLoader
in interfaceClassHierarchy
-
getDefaultClassLoader
- Specified by:
getDefaultClassLoader
in interfaceClassHierarchy
-
setBootstrapClassLoader
- Specified by:
setBootstrapClassLoader
in interfaceClassHierarchy
-
getBootstrapClassLoader
- Specified by:
getBootstrapClassLoader
in interfaceClassHierarchy
-
getClassLoaders
- Specified by:
getClassLoaders
in interfaceClassHierarchy
-
addClass
Description copied from interface:ClassHierarchy
Adds a JClass into class hierarchy. This API should be invoked everytimeJClassLoader
loads a new JClass.- Specified by:
addClass
in interfaceClassHierarchy
-
getIndex
-
getObject
-
allClasses
- Specified by:
allClasses
in interfaceClassHierarchy
-
applicationClasses
- Specified by:
applicationClasses
in interfaceClassHierarchy
-
getClass
- Specified by:
getClass
in interfaceClassHierarchy
-
getClass
- Specified by:
getClass
in interfaceClassHierarchy
-
getMethod
Description copied from interface:ClassHierarchy
Obtains a method by its signature.- Specified by:
getMethod
in interfaceClassHierarchy
- Parameters:
methodSig
- of the method- Returns:
- the
JMethod
for signature if found; otherwise, null.
-
getField
Description copied from interface:ClassHierarchy
Obtains a field by its signature.- Specified by:
getField
in interfaceClassHierarchy
- Parameters:
fieldSig
- signature of the field- Returns:
- the
JField
for signature if found; otherwise, null.
-
getJREClass
Description copied from interface:ClassHierarchy
Obtains a JRE class by it name.- Specified by:
getJREClass
in interfaceClassHierarchy
- Parameters:
name
- the class name- Returns:
- the
JClass
for name if found; otherwise, null.
-
getJREMethod
Description copied from interface:ClassHierarchy
Obtains a method declared in a JRE class by its signature.- Specified by:
getJREMethod
in interfaceClassHierarchy
- Parameters:
methodSig
- of the method- Returns:
- the
JMethod
for signature if found; otherwise, null.
-
getJREField
Description copied from interface:ClassHierarchy
Obtains a field declared in a JRE class by its signature.- Specified by:
getJREField
in interfaceClassHierarchy
- Parameters:
fieldSig
- signature of the field- Returns:
- the
JField
for signature if found; otherwise, null.
-
resolveMethod
Description copied from interface:ClassHierarchy
Resolves a method reference.- Specified by:
resolveMethod
in interfaceClassHierarchy
- Returns:
- the concrete method pointed by the method reference, or null if the concrete method cannot be found in the class hierarchy.
-
resolveField
Description copied from interface:ClassHierarchy
Resolves a field reference.- Specified by:
resolveField
in interfaceClassHierarchy
- Returns:
- the concrete field pointed by the field reference, or null if the concrete field cannot be found in the class hierarchy.
-
dispatch
Description copied from interface:ClassHierarchy
Dispatches a method reference on a receiver type.- Specified by:
dispatch
in interfaceClassHierarchy
- Returns:
- the target method. If the target cannot be found, returns null.
-
dispatch
Description copied from interface:ClassHierarchy
Dispatches a method reference on a receiver class.- Specified by:
dispatch
in interfaceClassHierarchy
- Returns:
- the target method. If the target cannot be found, returns null.
-
isSubclass
- Specified by:
isSubclass
in interfaceClassHierarchy
-
getAllSubclassesOf
Description copied from interface:ClassHierarchy
Returns all subclasses of the given class (including itself). If the given class is an interface, then return all its direct/indirect subinterfaces and their all direct/indirect implementors; otherwise, return all its direct/indirect subclasses.- Specified by:
getAllSubclassesOf
in interfaceClassHierarchy
- Parameters:
jclass
- the given class.- Returns:
- all subclasses of given class (including itself).
-
getDirectSubinterfacesOf
- Specified by:
getDirectSubinterfacesOf
in interfaceClassHierarchy
- Returns:
- the direct subinterfaces of given interface.
-
getDirectImplementorsOf
- Specified by:
getDirectImplementorsOf
in interfaceClassHierarchy
- Returns:
- the direct implementors of given interface.
-
getDirectSubclassesOf
- Specified by:
getDirectSubclassesOf
in interfaceClassHierarchy
- Returns:
- the direct subclasses of given class.
-
getDirectInnerClassesOf
- Specified by:
getDirectInnerClassesOf
in interfaceClassHierarchy
- Returns:
- the direct inner classes of
jclass
. Ifjclass
does not have inner classes, an empty collection is returned.
-