public class ClassInfo
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
ClassInfo.MethodHandler |
Modifier and Type | Field and Description |
---|---|
static int |
NO_VERSIONS |
static int |
VER_NEW |
static int |
VER_OLD |
Constructor and Description |
---|
ClassInfo() |
ClassInfo(byte[] classFileBytes,
int verCode,
PCDManager pcdm,
java.lang.String classFileFullPath)
Creates new ClassInfo out of a class file.
|
ClassInfo(byte[] classFileBytes,
PCDManager pcdm,
java.lang.String classFileFullPath)
Create a "lightweight" ClassInfo, that contains just the class name, super name, interfaces, flags and verCode.
|
ClassInfo(java.lang.String name,
PCDManager pcdm)
Even more lightweight variant - created for a deleted non-project class, to enable minimum possible checks.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
constFieldInitValuesEqual(ClassInfo oldClassInfo,
int oldFieldNo,
ClassInfo newClassInfo,
int newFieldNo)
Check if the initial values for the given primitive constatnts in two classes are the same.
|
boolean |
declaresField(ClassInfo classInfo,
int fieldNo)
Returns true if this class declares a field with the same name and type as
the field number fieldNo in class classInfo.
|
boolean |
declaresField(java.lang.String name,
java.lang.String signature,
boolean isStatic)
Returns true if this class declares a field with the given name, signature and access
|
boolean |
declaresMethod(ClassInfo classInfo,
int methodNo)
Returns true if this class declares a method with the same name and signature as
the method number methodNo in class classInfo.
|
int |
declaresSameNameMethod(java.lang.String methodName)
Returns a nonnegative number (position in the method array) if this class declares a method with the
name methodName, and -1 otherwise.
|
void |
findExistingSameNameMethods(java.lang.String methodName,
boolean includeSuperclasses,
boolean includeInterfaces,
ClassInfo.MethodHandler h)
Check this class and all its superclasses (if includeSuperclasses == true) and superinterfaces (if includeInterfaces == true)
for a method with the given name.
|
java.util.Set<java.lang.String> |
getAllImplementedIntfNames()
Returns the set of names of the interfaces transitively implemented by the given
class, that belong to the same project.
|
java.util.List<java.lang.String> |
getAllSuperclassNames()
Returns the names of the superclasses of the given class (transitively), that belong
to the same project, plus those of the superclasses that can be found on the class path
supplied to jmake, and on the boot class path.
|
int |
getDeclaredMethodPos(ClassInfo classInfo,
int methodNo)
If this class declares a method with the same name and signature as the given method,
return its position.
|
ClassInfo[] |
getDirectSubclasses()
Returns the array of all direct subclasses of this class (array of zero length if there are none).
|
int |
hasMethodThrowingException(ClassInfo excClassInfo,
int startMethodIdx)
If this class has a method that throws the given exception, return its index.
|
boolean |
implementsInterfaceDirectly(java.lang.String intfName) |
boolean |
implementsInterfaceDirectlyOrIndirectly(java.lang.String intfName)
Class C implements interface I indirectly, if C or some superclass of C directly implements I
or some subinterface of I.
|
boolean |
implementsIntfOrSubintfDirectly(java.lang.String intfName)
Check if this class implements interface I or any subinterface of I directly
|
void |
initializeImmediateTransientFields()
Initialize transient data that can be initialized immediately after this ClassInfo is read from the project database
|
boolean |
isAbstract() |
boolean |
isInterface() |
boolean |
isNonProjectClassTypeFieldSig(java.lang.String fieldSig)
Check if the given signature is of a class type, and that class does not belong to the project.
|
static boolean |
isPrimitiveFieldSig(java.lang.String fieldSig) |
boolean |
isPublic() |
boolean |
isSubclassOf(java.lang.String className,
boolean directOnly) |
boolean |
referencesClass(java.lang.String className,
boolean isRefTypeInterface,
int thorDegree)
Check if this class references the given class in different ways, depending on thorDegree parameter.
|
boolean |
referencesField(ClassInfo fieldDefClassInfo,
int fieldNo)
Check if this class references field number fieldNo of class fieldDefClassInfo.
|
boolean |
referencesMethod(ClassInfo methodDefClassInfo,
int methodNo)
Check if this class references method number methodNo of class methodDefClassInfo.
|
void |
restorePCDM(PCDManager pcdm)
Called to restore the pointer to the current PCDManager after this ClassInfo is brought back
from the store.
|
java.lang.String |
toString()
For debugging.
|
public static final int VER_OLD
public static final int VER_NEW
public static final int NO_VERSIONS
public ClassInfo(byte[] classFileBytes, int verCode, PCDManager pcdm, java.lang.String classFileFullPath)
public ClassInfo(byte[] classFileBytes, PCDManager pcdm, java.lang.String classFileFullPath)
public ClassInfo(java.lang.String name, PCDManager pcdm)
public ClassInfo()
public void initializeImmediateTransientFields()
public void restorePCDM(PCDManager pcdm)
public boolean isInterface()
public boolean isAbstract()
public boolean isPublic()
public java.util.List<java.lang.String> getAllSuperclassNames()
public java.util.Set<java.lang.String> getAllImplementedIntfNames()
public ClassInfo[] getDirectSubclasses()
public static boolean constFieldInitValuesEqual(ClassInfo oldClassInfo, int oldFieldNo, ClassInfo newClassInfo, int newFieldNo)
public boolean implementsInterfaceDirectly(java.lang.String intfName)
public boolean implementsIntfOrSubintfDirectly(java.lang.String intfName)
public boolean implementsInterfaceDirectlyOrIndirectly(java.lang.String intfName)
public boolean declaresField(ClassInfo classInfo, int fieldNo)
public boolean declaresField(java.lang.String name, java.lang.String signature, boolean isStatic)
public boolean declaresMethod(ClassInfo classInfo, int methodNo)
public int getDeclaredMethodPos(ClassInfo classInfo, int methodNo)
public int declaresSameNameMethod(java.lang.String methodName)
public boolean referencesClass(java.lang.String className, boolean isRefTypeInterface, int thorDegree)
public boolean isSubclassOf(java.lang.String className, boolean directOnly)
public boolean referencesField(ClassInfo fieldDefClassInfo, int fieldNo)
public boolean referencesMethod(ClassInfo methodDefClassInfo, int methodNo)
public int hasMethodThrowingException(ClassInfo excClassInfo, int startMethodIdx)
public void findExistingSameNameMethods(java.lang.String methodName, boolean includeSuperclasses, boolean includeInterfaces, ClassInfo.MethodHandler h)
public static boolean isPrimitiveFieldSig(java.lang.String fieldSig)
public boolean isNonProjectClassTypeFieldSig(java.lang.String fieldSig)
public java.lang.String toString()
toString
in class java.lang.Object