Package proguard.classfile
Class LibraryClass
- java.lang.Object
-
- proguard.util.SimpleProcessable
-
- proguard.util.SimpleFeatureNamedProcessable
-
- proguard.classfile.LibraryClass
-
- All Implemented Interfaces:
java.io.Serializable
,Clazz
,FeatureNamed
,Processable
public class LibraryClass extends SimpleFeatureNamedProcessable implements Clazz
ThisClazz
is a compact representation of the essential data in a Java class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description LibraryField[]
fields
Clazz[]
interfaceClasses
An extra field pointing to the interfaces of this class.java.lang.String[]
interfaceNames
KotlinMetadata
kotlinMetadata
LibraryMethod[]
methods
int
subClassCount
Clazz[]
subClasses
An extra field pointing to the subclasses of this class.Clazz
superClass
An extra field pointing to the superclass of this class.java.lang.String
superClassName
java.lang.String
thisClassName
int
u2accessFlags
-
Fields inherited from class proguard.util.SimpleFeatureNamedProcessable
extraFeatureNames, featureName
-
Fields inherited from class proguard.util.SimpleProcessable
processingFlags, processingInfo
-
-
Constructor Summary
Constructors Constructor Description LibraryClass()
Creates an empty LibraryClass.LibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName)
Creates an initialized LibraryClassLibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName, java.lang.String[] interfaceNames, Clazz[] interfaceClasses, int subClassCount, Clazz[] subClasses, LibraryField[] fields, LibraryMethod[] methods, KotlinMetadata kotlinMetadata)
Creates an initialized LibraryClassLibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName, KotlinMetadata kotlinMetadata)
Creates an initialized LibraryClass
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ClassVisitor classVisitor)
Accepts the given class visitor.void
addSubClass(Clazz clazz)
Notifies this Clazz that it is being subclassed by another class.void
attributeAccept(java.lang.String name, AttributeVisitor attributeVisitor)
Lets the given attribute info visitor visit the specified attribute.void
attributesAccept(AttributeVisitor attributeVisitor)
Lets the given attribute info visitor visit all attributes of this class.void
constantPoolEntriesAccept(ConstantVisitor constantVisitor)
Lets the given constant pool entry visitor visit all constant pool entries of this class.void
constantPoolEntryAccept(int index, ConstantVisitor constantVisitor)
Lets the given constant pool entry visitor visit the constant pool entry at the specified index.boolean
extends_(java.lang.String className)
Returns whether this class extends the specified class.boolean
extends_(Clazz clazz)
Returns whether this class extends the given class.boolean
extendsOrImplements(java.lang.String className)
Returns whether this class implements the specified class.boolean
extendsOrImplements(Clazz clazz)
Returns whether this class implements the given class.void
fieldAccept(java.lang.String name, java.lang.String descriptor, MemberVisitor memberVisitor)
Lets the given member info visitor visit the specified field.void
fieldsAccept(MemberVisitor memberVisitor)
Lets the given member info visitor visit all fields of this class.Field
findField(java.lang.String name, java.lang.String descriptor)
Returns the field with the given name and descriptor.Method
findMethod(java.lang.String name, java.lang.String descriptor)
Returns the method with the given name and descriptor.int
getAccessFlags()
Returns the access flags of this class.java.lang.String
getClassName(int constantIndex)
Returns the class name of ClassConstant at the specified index.Clazz
getInterface(int index)
Returns the interface at the given index.int
getInterfaceCount()
Returns the number of interfaces that this class implements.java.lang.String
getInterfaceName(int index)
Returns the full internal name of the interface at the given index of this class.java.lang.String
getModuleName(int constantIndex)
Returns the name of the ModuleConstant at the specified index.java.lang.String
getName()
Returns the full internal name of this class.java.lang.String
getName(int constantIndex)
Returns the name of the NameAndTypeConstant at the specified index.java.lang.String
getPackageName(int constantIndex)
Returns the name of the PackageConstant at the specified index.java.lang.String
getRefClassName(int constantIndex)
Returns the class name of the RefConstant at the specified index.java.lang.String
getRefName(int constantIndex)
Returns the name of the RefConstant at the specified index.java.lang.String
getRefType(int constantIndex)
Returns the type of the RefConstant at the specified index.java.lang.String
getString(int constantIndex)
Returns the String value of the Utf8Constant at the specified index.java.lang.String
getStringString(int constantIndex)
Returns the String value of the StringConstant at the specified index.Clazz
getSuperClass()
Returns the super class of this class.java.lang.String
getSuperName()
Returns the full internal name of the super class of this class, or null if this class represents java.lang.Object.int
getTag(int constantIndex)
Returns the tag value of the Constant at the specified index.java.lang.String
getType(int constantIndex)
Returns the type of the NameAndTypeConstant at the specified index.void
hierarchyAccept(boolean visitThisClass, boolean visitSuperClass, boolean visitInterfaces, boolean visitSubclasses, ClassVisitor classVisitor)
Accepts the given class visitor in the class hierarchy.void
interfaceConstantsAccept(ConstantVisitor constantVisitor)
Lets the given constant pool entry visitor visit the class constant pool entries for all interfaces of this class.void
interfacesAccept(ClassVisitor classVisitor)
Lets the given class visitor visit all known direct interfaces.void
kotlinMetadataAccept(KotlinMetadataVisitor kotlinMetadataVisitor)
Lets the given Kotlin metadata visitor visit the metadata of this class.boolean
mayHaveImplementations(Method method)
Returns whether the given method may possibly have implementing or overriding methods down the class hierarchy.void
methodAccept(java.lang.String name, java.lang.String descriptor, MemberVisitor memberVisitor)
Lets the given member info visitor visit the specified method.void
methodsAccept(MemberVisitor memberVisitor)
Lets the given member info visitor visit all methods of this class.void
removeSubClass(Clazz clazz)
Notifies this Clazz that it is no longer being subclassed by another class.void
subclassesAccept(ClassVisitor classVisitor)
Lets the given class visitor visit all known subclasses.void
superClassAccept(ClassVisitor classVisitor)
Lets the given class visitor visit the superclass, if it is known.void
superClassConstantAccept(ConstantVisitor constantVisitor)
Lets the given constant pool entry visitor visit the class constant pool entry of the super class of this class, if there is one.void
thisClassConstantAccept(ConstantVisitor constantVisitor)
Lets the given constant pool entry visitor visit the class constant pool entry of this class.java.lang.String
toString()
-
Methods inherited from class proguard.util.SimpleFeatureNamedProcessable
addExtraFeatureName, getExtraFeatureNames, getFeatureName, isInFeature, setFeatureName
-
Methods inherited from class proguard.util.SimpleProcessable
addProcessingFlags, getProcessingFlags, getProcessingInfo, hasProcessingFlags, removeProcessingFlags, setProcessingFlags, setProcessingInfo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface proguard.util.FeatureNamed
addExtraFeatureName, getExtraFeatureNames, getFeatureName, isInFeature, setFeatureName
-
Methods inherited from interface proguard.util.Processable
getProcessingFlags, getProcessingInfo, setProcessingFlags, setProcessingInfo
-
-
-
-
Field Detail
-
u2accessFlags
public int u2accessFlags
-
thisClassName
public java.lang.String thisClassName
-
superClassName
public java.lang.String superClassName
-
interfaceNames
public java.lang.String[] interfaceNames
-
fields
public LibraryField[] fields
-
methods
public LibraryMethod[] methods
-
kotlinMetadata
public KotlinMetadata kotlinMetadata
-
superClass
public Clazz superClass
An extra field pointing to the superclass of this class. This field is filled out by theClassSuperHierarchyInitializer
.
-
interfaceClasses
public Clazz[] interfaceClasses
An extra field pointing to the interfaces of this class. This field is filled out by theClassSuperHierarchyInitializer
.
-
subClasses
public Clazz[] subClasses
An extra field pointing to the subclasses of this class. This field is filled out by theClassSubHierarchyInitializer
.
-
subClassCount
public int subClassCount
-
-
Constructor Detail
-
LibraryClass
public LibraryClass()
Creates an empty LibraryClass.
-
LibraryClass
public LibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName)
Creates an initialized LibraryClass- Parameters:
u2accessFlags
- access flags for the new class.thisClassName
- the fully qualified name of the new class.superClassName
- the fully qualified name of the super class.
-
LibraryClass
public LibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName, KotlinMetadata kotlinMetadata)
Creates an initialized LibraryClass- Parameters:
u2accessFlags
- access flags for the new class.thisClassName
- the fully qualified name of the new class.superClassName
- the fully qualified name of the super class.kotlinMetadata
- the metadata attached to this class if it is a Kotlin class.
-
LibraryClass
public LibraryClass(int u2accessFlags, java.lang.String thisClassName, java.lang.String superClassName, java.lang.String[] interfaceNames, Clazz[] interfaceClasses, int subClassCount, Clazz[] subClasses, LibraryField[] fields, LibraryMethod[] methods, KotlinMetadata kotlinMetadata)
Creates an initialized LibraryClass- Parameters:
u2accessFlags
- access flags for the new class.thisClassName
- the fully qualified name of the new class.superClassName
- the fully qualified name of the super class.interfaceNames
- the names of the interfaces that are implemented by this class.interfaceClasses
- references to the interface classes of the interfaces that are implemented by this class.subClassCount
- the number of subclasses of this class.subClasses
- references to the subclasses of this class.fields
- references to the fields of this class.methods
- references to the methods of this class.kotlinMetadata
- the metadata attached to this class if it is a Kotlin class
-
-
Method Detail
-
getAccessFlags
public int getAccessFlags()
Description copied from interface:Clazz
Returns the access flags of this class.- Specified by:
getAccessFlags
in interfaceClazz
- See Also:
ClassConstants
-
getName
public java.lang.String getName()
Description copied from interface:Clazz
Returns the full internal name of this class.
-
getSuperName
public java.lang.String getSuperName()
Description copied from interface:Clazz
Returns the full internal name of the super class of this class, or null if this class represents java.lang.Object.- Specified by:
getSuperName
in interfaceClazz
-
getInterfaceCount
public int getInterfaceCount()
Description copied from interface:Clazz
Returns the number of interfaces that this class implements.- Specified by:
getInterfaceCount
in interfaceClazz
-
getInterfaceName
public java.lang.String getInterfaceName(int index)
Description copied from interface:Clazz
Returns the full internal name of the interface at the given index of this class.- Specified by:
getInterfaceName
in interfaceClazz
-
getTag
public int getTag(int constantIndex)
Description copied from interface:Clazz
Returns the tag value of the Constant at the specified index.
-
getString
public java.lang.String getString(int constantIndex)
Description copied from interface:Clazz
Returns the String value of the Utf8Constant at the specified index.
-
getStringString
public java.lang.String getStringString(int constantIndex)
Description copied from interface:Clazz
Returns the String value of the StringConstant at the specified index.- Specified by:
getStringString
in interfaceClazz
-
getClassName
public java.lang.String getClassName(int constantIndex)
Description copied from interface:Clazz
Returns the class name of ClassConstant at the specified index.- Specified by:
getClassName
in interfaceClazz
-
getName
public java.lang.String getName(int constantIndex)
Description copied from interface:Clazz
Returns the name of the NameAndTypeConstant at the specified index.
-
getType
public java.lang.String getType(int constantIndex)
Description copied from interface:Clazz
Returns the type of the NameAndTypeConstant at the specified index.
-
getRefClassName
public java.lang.String getRefClassName(int constantIndex)
Description copied from interface:Clazz
Returns the class name of the RefConstant at the specified index.- Specified by:
getRefClassName
in interfaceClazz
-
getRefName
public java.lang.String getRefName(int constantIndex)
Description copied from interface:Clazz
Returns the name of the RefConstant at the specified index.- Specified by:
getRefName
in interfaceClazz
-
getRefType
public java.lang.String getRefType(int constantIndex)
Description copied from interface:Clazz
Returns the type of the RefConstant at the specified index.- Specified by:
getRefType
in interfaceClazz
-
getModuleName
public java.lang.String getModuleName(int constantIndex)
Description copied from interface:Clazz
Returns the name of the ModuleConstant at the specified index.- Specified by:
getModuleName
in interfaceClazz
-
getPackageName
public java.lang.String getPackageName(int constantIndex)
Description copied from interface:Clazz
Returns the name of the PackageConstant at the specified index.- Specified by:
getPackageName
in interfaceClazz
-
addSubClass
public void addSubClass(Clazz clazz)
Description copied from interface:Clazz
Notifies this Clazz that it is being subclassed by another class.- Specified by:
addSubClass
in interfaceClazz
-
removeSubClass
public void removeSubClass(Clazz clazz)
Description copied from interface:Clazz
Notifies this Clazz that it is no longer being subclassed by another class.- Specified by:
removeSubClass
in interfaceClazz
-
getSuperClass
public Clazz getSuperClass()
Description copied from interface:Clazz
Returns the super class of this class.- Specified by:
getSuperClass
in interfaceClazz
-
getInterface
public Clazz getInterface(int index)
Description copied from interface:Clazz
Returns the interface at the given index.- Specified by:
getInterface
in interfaceClazz
-
extends_
public boolean extends_(Clazz clazz)
Description copied from interface:Clazz
Returns whether this class extends the given class. A class is always considered to extend itself. Interfaces are considered to only extend the root Object class.
-
extends_
public boolean extends_(java.lang.String className)
Description copied from interface:Clazz
Returns whether this class extends the specified class. A class is always considered to extend itself. Interfaces are considered to only extend the root Object class.
-
extendsOrImplements
public boolean extendsOrImplements(Clazz clazz)
Description copied from interface:Clazz
Returns whether this class implements the given class. A class is always considered to implement itself. Interfaces are considered to implement all their superinterfaces.- Specified by:
extendsOrImplements
in interfaceClazz
-
extendsOrImplements
public boolean extendsOrImplements(java.lang.String className)
Description copied from interface:Clazz
Returns whether this class implements the specified class. A class is always considered to implement itself. Interfaces are considered to implement all their superinterfaces.- Specified by:
extendsOrImplements
in interfaceClazz
-
findField
public Field findField(java.lang.String name, java.lang.String descriptor)
Description copied from interface:Clazz
Returns the field with the given name and descriptor.
-
findMethod
public Method findMethod(java.lang.String name, java.lang.String descriptor)
Description copied from interface:Clazz
Returns the method with the given name and descriptor.- Specified by:
findMethod
in interfaceClazz
- Parameters:
name
- the method name, or null if it is irrelevant.descriptor
- the method descriptor, or null if it is irrelevant.- Returns:
- the first matching method, or null there is no matching method.
-
accept
public void accept(ClassVisitor classVisitor)
Description copied from interface:Clazz
Accepts the given class visitor.
-
hierarchyAccept
public void hierarchyAccept(boolean visitThisClass, boolean visitSuperClass, boolean visitInterfaces, boolean visitSubclasses, ClassVisitor classVisitor)
Description copied from interface:Clazz
Accepts the given class visitor in the class hierarchy.- Specified by:
hierarchyAccept
in interfaceClazz
- Parameters:
visitThisClass
- specifies whether to visit this class.visitSuperClass
- specifies whether to visit the super classes.visitInterfaces
- specifies whether to visit the interfaces.visitSubclasses
- specifies whether to visit the subclasses.classVisitor
- theClassVisitor
that will visit the class hierarchy.
-
superClassAccept
public void superClassAccept(ClassVisitor classVisitor)
Lets the given class visitor visit the superclass, if it is known.- Parameters:
classVisitor
- theClassVisitor
that will visit the superclass.
-
interfacesAccept
public void interfacesAccept(ClassVisitor classVisitor)
Lets the given class visitor visit all known direct interfaces.- Parameters:
classVisitor
- theClassVisitor
that will visit the interfaces.
-
subclassesAccept
public void subclassesAccept(ClassVisitor classVisitor)
Description copied from interface:Clazz
Lets the given class visitor visit all known subclasses.- Specified by:
subclassesAccept
in interfaceClazz
- Parameters:
classVisitor
- theClassVisitor
that will visit the subclasses.
-
constantPoolEntriesAccept
public void constantPoolEntriesAccept(ConstantVisitor constantVisitor)
Description copied from interface:Clazz
Lets the given constant pool entry visitor visit all constant pool entries of this class.- Specified by:
constantPoolEntriesAccept
in interfaceClazz
-
constantPoolEntryAccept
public void constantPoolEntryAccept(int index, ConstantVisitor constantVisitor)
Description copied from interface:Clazz
Lets the given constant pool entry visitor visit the constant pool entry at the specified index.- Specified by:
constantPoolEntryAccept
in interfaceClazz
-
thisClassConstantAccept
public void thisClassConstantAccept(ConstantVisitor constantVisitor)
Description copied from interface:Clazz
Lets the given constant pool entry visitor visit the class constant pool entry of this class.- Specified by:
thisClassConstantAccept
in interfaceClazz
-
superClassConstantAccept
public void superClassConstantAccept(ConstantVisitor constantVisitor)
Description copied from interface:Clazz
Lets the given constant pool entry visitor visit the class constant pool entry of the super class of this class, if there is one.- Specified by:
superClassConstantAccept
in interfaceClazz
-
interfaceConstantsAccept
public void interfaceConstantsAccept(ConstantVisitor constantVisitor)
Description copied from interface:Clazz
Lets the given constant pool entry visitor visit the class constant pool entries for all interfaces of this class.- Specified by:
interfaceConstantsAccept
in interfaceClazz
-
fieldsAccept
public void fieldsAccept(MemberVisitor memberVisitor)
Description copied from interface:Clazz
Lets the given member info visitor visit all fields of this class.- Specified by:
fieldsAccept
in interfaceClazz
-
fieldAccept
public void fieldAccept(java.lang.String name, java.lang.String descriptor, MemberVisitor memberVisitor)
Description copied from interface:Clazz
Lets the given member info visitor visit the specified field.- Specified by:
fieldAccept
in interfaceClazz
-
methodsAccept
public void methodsAccept(MemberVisitor memberVisitor)
Description copied from interface:Clazz
Lets the given member info visitor visit all methods of this class.- Specified by:
methodsAccept
in interfaceClazz
-
methodAccept
public void methodAccept(java.lang.String name, java.lang.String descriptor, MemberVisitor memberVisitor)
Description copied from interface:Clazz
Lets the given member info visitor visit the specified method.- Specified by:
methodAccept
in interfaceClazz
-
mayHaveImplementations
public boolean mayHaveImplementations(Method method)
Description copied from interface:Clazz
Returns whether the given method may possibly have implementing or overriding methods down the class hierarchy. This can only be true if the class is not final, and the method is not private, static, or final, or a constructor.- Specified by:
mayHaveImplementations
in interfaceClazz
- Parameters:
method
- the method that may have implementations.- Returns:
- whether it may have implementations.
-
attributesAccept
public void attributesAccept(AttributeVisitor attributeVisitor)
Description copied from interface:Clazz
Lets the given attribute info visitor visit all attributes of this class.- Specified by:
attributesAccept
in interfaceClazz
-
attributeAccept
public void attributeAccept(java.lang.String name, AttributeVisitor attributeVisitor)
Description copied from interface:Clazz
Lets the given attribute info visitor visit the specified attribute.- Specified by:
attributeAccept
in interfaceClazz
-
kotlinMetadataAccept
public void kotlinMetadataAccept(KotlinMetadataVisitor kotlinMetadataVisitor)
Description copied from interface:Clazz
Lets the given Kotlin metadata visitor visit the metadata of this class.- Specified by:
kotlinMetadataAccept
in interfaceClazz
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-