Package pascal.taie.language.classes
Interface ClassHierarchy
- All Superinterfaces:
Indexer<JClass>
,Serializable
- All Known Implementing Classes:
ClassHierarchyImpl
Manages the classes and class-related resolution of the program being analyzed.
-
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.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.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)
-
Method Details
-
setDefaultClassLoader
-
getDefaultClassLoader
JClassLoader getDefaultClassLoader() -
setBootstrapClassLoader
-
getBootstrapClassLoader
JClassLoader getBootstrapClassLoader() -
getClassLoaders
Collection<JClassLoader> getClassLoaders() -
addClass
Adds a JClass into class hierarchy. This API should be invoked everytimeJClassLoader
loads a new JClass. -
allClasses
-
applicationClasses
-
getClass
-
getClass
-
getMethod
Obtains a method by its signature.- Parameters:
methodSig
- of the method- Returns:
- the
JMethod
for signature if found; otherwise, null. - Throws:
AnalysisException
- if signature is invalid.
-
getField
Obtains a field by its signature.- Parameters:
fieldSig
- signature of the field- Returns:
- the
JField
for signature if found; otherwise, null. - Throws:
AnalysisException
- if signature is invalid.
-
getJREClass
Obtains a JRE class by it name.- Parameters:
name
- the class name- Returns:
- the
JClass
for name if found; otherwise, null.
-
getJREMethod
Obtains a method declared in a JRE class by its signature.- Parameters:
methodSig
- of the method- Returns:
- the
JMethod
for signature if found; otherwise, null. - Throws:
AnalysisException
- if signature is invalid.
-
getJREField
Obtains a field declared in a JRE class by its signature.- Parameters:
fieldSig
- signature of the field- Returns:
- the
JField
for signature if found; otherwise, null. - Throws:
AnalysisException
- if signature is invalid.
-
resolveMethod
Resolves a method reference.- Returns:
- the concrete method pointed by the method reference, or null if the concrete method cannot be found in the class hierarchy.
-
resolveField
Resolves a field reference.- Returns:
- the concrete field pointed by the field reference, or null if the concrete field cannot be found in the class hierarchy.
-
dispatch
Dispatches a method reference on a receiver type.- Returns:
- the target method. If the target cannot be found, returns null.
- Throws:
AnalysisException
- if given receiver type cannot be dispatched (e.g., given a primitive type).
-
dispatch
Dispatches a method reference on a receiver class.- Returns:
- the target method. If the target cannot be found, returns null.
-
getDirectSubinterfacesOf
- Returns:
- the direct subinterfaces of given interface.
-
getDirectImplementorsOf
- Returns:
- the direct implementors of given interface.
-
getDirectSubclassesOf
- Returns:
- the direct subclasses of given class.
-
isSubclass
-
getAllSubclassesOf
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.- Parameters:
jclass
- the given class.- Returns:
- all subclasses of given class (including itself).
-
getDirectInnerClassesOf
- Returns:
- the direct inner classes of
jclass
. Ifjclass
does not have inner classes, an empty collection is returned.
-