Package aQute.bnd.osgi
Class Clazz
- java.lang.Object
-
- aQute.bnd.osgi.Clazz
-
public class Clazz extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classClazz.AssocDeprecated.classClazz.ClassConstantDeprecated.(package private) classClazz.ClassDef(package private) classClazz.CodeDefclassClazz.Def(package private) classClazz.ElementDefclassClazz.FieldDefstatic classClazz.JAVAclassClazz.MethodDefstatic classClazz.MethodParameterstatic classClazz.QUERYclassClazz.TypeDef
-
Field Summary
Fields Modifier and Type Field Description (package private) static intACC_BRIDGE(package private) static intACC_SYNTHETIC(package private) Analyzeranalyzerprivate java.util.Set<Descriptors.TypeRef>annotationsprivate java.util.Set<Descriptors.PackageRef>apiprivate intclass$(package private) Clazz.ClassDefclassDefprivate ClassFileclassFileprivate ConstantPoolconstantPoolprivate intforNamestatic java.util.EnumSet<Clazz.QUERY>HAS_ARGUMENTprivate booleanhasClassAnnotationsprivate booleanhasDefaultConstructorprivate booleanhasRuntimeAnnotationsprivate java.util.Set<Descriptors.PackageRef>importsprivate Descriptors.TypeRef[]interfacesprivate static org.slf4j.Loggerloggerstatic java.util.Comparator<Clazz>NAME_COMPARATOR(package private) java.lang.Stringpathprivate java.util.Map<Descriptors.TypeRef,java.lang.Integer>referred(package private) Resourceresource(package private) Descriptors.TypeRefsuperClassstatic intTYPEUSE_INDEX_NONEstatic intTYPEUSE_TARGET_INDEX_EXTENDSprivate java.util.Set<Descriptors.TypeRef>xref
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) java.lang.ObjectannotationDefault(AnnotationDefaultAttribute attribute, int access_flags)java.util.Set<Descriptors.TypeRef>annotations()java.util.stream.Stream<Annotation>annotations(java.lang.String binaryNameFilter)private java.util.Map<java.lang.String,java.lang.Object>annotationValues(ElementValueInfo[] values, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidclassConstRef(int index)private voidclassConstRef(java.lang.String name)(package private) static Annotation.ElementTypeelementType(ClassFile classFile)(package private) static Annotation.ElementTypeelementType(FieldInfo fieldInfo)(package private) static Annotation.ElementTypeelementType(MethodInfo methodInfo)java.util.stream.Stream<Clazz.FieldDef>fields()private intfindMethodReference(java.lang.String clazz, java.lang.String methodname, java.lang.String descriptor)Find a method reference in the pool that points to the given class, methodname and descriptor.java.lang.StringgetAbsolutePath()intgetAccess()java.util.Set<Descriptors.PackageRef>getAPIUses()Descriptors.TypeRefgetClassName()java.lang.StringgetClassSignature()java.util.Map<java.lang.String,java.lang.Object>getDefaults()Clazz.TypeDefgetExtends(Descriptors.TypeRef type)Clazz.JAVAgetFormat()java.lang.StringgetFQN()Clazz.TypeDefgetImplements(Descriptors.TypeRef type)Descriptors.TypeRef[]getInterfaces()Clazz.MethodDefgetMethodDef(int access, java.lang.String name, java.lang.String descriptor)Deprecated.java.util.Set<Descriptors.PackageRef>getReferred()ResourcegetResource()java.lang.StringgetSourceFile()Descriptors.TypeRefgetSuper()booleanhasPublicNoArgsConstructor()private java.util.stream.Stream<Clazz>hierarchyStream(Analyzer analyzer)java.util.List<Descriptors.TypeRef>interfaces()booleanis(Clazz.QUERY query, Instruction instr, Analyzer analyzer)booleanisAbstract()booleanisAnnotation()(package private) static booleanisAnnotation(int access)booleanisDeprecated()booleanisEnum()(package private) static booleanisEnum(int access)booleanisFinal()booleanisInnerClass()booleanisInterface()booleanisModule()(package private) static booleanisModule(int access)booleanisProtected()booleanisPublic()booleanisSynthetic()(package private) static booleanisSynthetic(int access)java.util.stream.Stream<Clazz.MethodDef>methods()(package private) AnnotationnewAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private java.lang.ObjectnewElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)(package private) ParameterAnnotationnewParameterAnnotation(int parameter, AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)(package private) TypeAnnotationnewTypeAnnotation(TypeAnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)static java.lang.StringobjectDescriptorToFQN(java.lang.String string)java.util.Set<Descriptors.TypeRef>parseClassFile()java.util.Set<Descriptors.TypeRef>parseClassFile(java.io.InputStream in)java.util.Set<Descriptors.TypeRef>parseClassFile(java.io.InputStream in, ClassDataCollector cd)private java.util.Set<Descriptors.TypeRef>parseClassFileData(java.io.DataInput in)private java.util.Set<Descriptors.TypeRef>parseClassFileData(java.io.DataInput in, ClassDataCollector cd)java.util.Set<Descriptors.TypeRef>parseClassFileWithCollector(ClassDataCollector cd)voidparseDescriptor(java.lang.String descriptor, int modifiers)Deprecated.private voidprocessAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidprocessAnnotationDefault(AnnotationDefaultAttribute attribute, Annotation.ElementType elementType, int access_flags)private voidprocessAnnotations(AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidprocessAttributes(Attribute[] attributes, Annotation.ElementType elementType, int access_flags)Called for the attributes in the class, field, method or Code attribute.private voidprocessBootstrapMethods(BootstrapMethodsAttribute attribute)private voidprocessCode(CodeAttribute attribute, Annotation.ElementType elementType)private voidprocessElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidprocessEnclosingMethod(EnclosingMethodAttribute attribute)private voidprocessExceptions(ExceptionsAttribute attribute, int access_flags)private voidprocessParameterAnnotations(ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidprocessSignature(SignatureAttribute attribute, Annotation.ElementType elementType, int access_flags)private voidprocessStackMapTable(StackMapTableAttribute attribute)private voidprocessTypeAnnotations(TypeAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidreferTo(Descriptors.TypeRef typeRef, int modifiers)Add a new package reference.private voidreferTo(java.lang.String descriptor, int modifiers)voidreset()Deprecated.voidsetDeprecated(boolean b)Deprecated.voidsetInnerAccess(int access)Deprecated.java.lang.StringtoString()java.util.stream.Stream<TypeAnnotation>typeAnnotations(java.lang.String binaryNameFilter)private java.util.stream.Stream<Descriptors.TypeRef>typeStream(Analyzer analyzer, java.util.function.Function<? super Clazz,java.util.Collection<? extends Descriptors.TypeRef>> func, java.util.Set<Descriptors.TypeRef> visited)static java.lang.StringunCamel(java.lang.String id)private voidverification_type_info(StackMapTableAttribute.VerificationTypeInfo verificationTypeInfo)private voidvisitAnnotationDefault(ClassDataCollector cd, AnnotationDefaultAttribute attribute, Clazz.ElementDef elementDef)private voidvisitAnnotations(ClassDataCollector cd, AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidvisitAttributes(ClassDataCollector cd, Clazz.ElementDef elementDef)Called for the attributes in the class, field, or method.private voidvisitClassFile(ClassDataCollector cd)private voidvisitCode(ClassDataCollector cd, CodeAttribute attribute, Annotation.ElementType elementType)private voidvisitConstantValue(ClassDataCollector cd, ConstantValueAttribute attribute)private voidvisitEnclosingMethod(ClassDataCollector cd, EnclosingMethodAttribute attribute)private voidvisitInnerClasses(ClassDataCollector cd, InnerClassesAttribute attribute)private voidvisitMethodParameters(ClassDataCollector cd, MethodParametersAttribute attribute, Clazz.ElementDef elementDef)private voidvisitParameterAnnotations(ClassDataCollector cd, ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)private voidvisitReferenceMethod(ClassDataCollector cd, int method_ref_index)Called when crawling the byte code and a method reference is foundprivate voidvisitSignature(ClassDataCollector cd, SignatureAttribute attribute)private voidvisitTypeAnnotations(ClassDataCollector cd, TypeAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
HAS_ARGUMENT
public static final java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
-
ACC_SYNTHETIC
static final int ACC_SYNTHETIC
- See Also:
- Constant Field Values
-
ACC_BRIDGE
static final int ACC_BRIDGE
- See Also:
- Constant Field Values
-
NAME_COMPARATOR
public static final java.util.Comparator<Clazz> NAME_COMPARATOR
-
hasRuntimeAnnotations
private boolean hasRuntimeAnnotations
-
hasClassAnnotations
private boolean hasClassAnnotations
-
hasDefaultConstructor
private boolean hasDefaultConstructor
-
imports
private java.util.Set<Descriptors.PackageRef> imports
-
xref
private java.util.Set<Descriptors.TypeRef> xref
-
annotations
private java.util.Set<Descriptors.TypeRef> annotations
-
forName
private int forName
-
class$
private int class$
-
api
private java.util.Set<Descriptors.PackageRef> api
-
classFile
private ClassFile classFile
-
constantPool
private ConstantPool constantPool
-
superClass
Descriptors.TypeRef superClass
-
interfaces
private Descriptors.TypeRef[] interfaces
-
classDef
Clazz.ClassDef classDef
-
referred
private java.util.Map<Descriptors.TypeRef,java.lang.Integer> referred
-
analyzer
final Analyzer analyzer
-
path
final java.lang.String path
-
resource
final Resource resource
-
TYPEUSE_INDEX_NONE
public static final int TYPEUSE_INDEX_NONE
- See Also:
- Constant Field Values
-
TYPEUSE_TARGET_INDEX_EXTENDS
public static final int TYPEUSE_TARGET_INDEX_EXTENDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile() throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile(java.io.InputStream in) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFileWithCollector
public java.util.Set<Descriptors.TypeRef> parseClassFileWithCollector(ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFile
public java.util.Set<Descriptors.TypeRef> parseClassFile(java.io.InputStream in, ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFileData
private java.util.Set<Descriptors.TypeRef> parseClassFileData(java.io.DataInput in, ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseClassFileData
private java.util.Set<Descriptors.TypeRef> parseClassFileData(java.io.DataInput in) throws java.lang.Exception
- Throws:
java.lang.Exception
-
visitClassFile
private void visitClassFile(ClassDataCollector cd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fields
public java.util.stream.Stream<Clazz.FieldDef> fields()
-
methods
public java.util.stream.Stream<Clazz.MethodDef> methods()
-
findMethodReference
private int findMethodReference(java.lang.String clazz, java.lang.String methodname, java.lang.String descriptor)Find a method reference in the pool that points to the given class, methodname and descriptor.- Parameters:
clazz-methodname-descriptor-- Returns:
- index in constant pool
-
processAttributes
private void processAttributes(Attribute[] attributes, Annotation.ElementType elementType, int access_flags)
Called for the attributes in the class, field, method or Code attribute.
-
visitAttributes
private void visitAttributes(ClassDataCollector cd, Clazz.ElementDef elementDef) throws java.lang.Exception
Called for the attributes in the class, field, or method.- Throws:
java.lang.Exception
-
processEnclosingMethod
private void processEnclosingMethod(EnclosingMethodAttribute attribute)
-
visitEnclosingMethod
private void visitEnclosingMethod(ClassDataCollector cd, EnclosingMethodAttribute attribute)
-
visitInnerClasses
private void visitInnerClasses(ClassDataCollector cd, InnerClassesAttribute attribute) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processSignature
private void processSignature(SignatureAttribute attribute, Annotation.ElementType elementType, int access_flags)
-
visitSignature
private void visitSignature(ClassDataCollector cd, SignatureAttribute attribute)
-
processAnnotationDefault
private void processAnnotationDefault(AnnotationDefaultAttribute attribute, Annotation.ElementType elementType, int access_flags)
-
visitAnnotationDefault
private void visitAnnotationDefault(ClassDataCollector cd, AnnotationDefaultAttribute attribute, Clazz.ElementDef elementDef)
-
elementType
static Annotation.ElementType elementType(FieldInfo fieldInfo)
-
elementType
static Annotation.ElementType elementType(MethodInfo methodInfo)
-
elementType
static Annotation.ElementType elementType(ClassFile classFile)
-
annotationDefault
java.lang.Object annotationDefault(AnnotationDefaultAttribute attribute, int access_flags)
-
visitConstantValue
private void visitConstantValue(ClassDataCollector cd, ConstantValueAttribute attribute)
-
processExceptions
private void processExceptions(ExceptionsAttribute attribute, int access_flags)
-
visitMethodParameters
private void visitMethodParameters(ClassDataCollector cd, MethodParametersAttribute attribute, Clazz.ElementDef elementDef)
-
processCode
private void processCode(CodeAttribute attribute, Annotation.ElementType elementType)
-
visitCode
private void visitCode(ClassDataCollector cd, CodeAttribute attribute, Annotation.ElementType elementType) throws java.lang.Exception
- Throws:
java.lang.Exception
-
visitReferenceMethod
private void visitReferenceMethod(ClassDataCollector cd, int method_ref_index)
Called when crawling the byte code and a method reference is found
-
processParameterAnnotations
private void processParameterAnnotations(ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
visitParameterAnnotations
private void visitParameterAnnotations(ClassDataCollector cd, ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processTypeAnnotations
private void processTypeAnnotations(TypeAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
visitTypeAnnotations
private void visitTypeAnnotations(ClassDataCollector cd, TypeAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processAnnotations
private void processAnnotations(AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
visitAnnotations
private void visitAnnotations(ClassDataCollector cd, AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processAnnotation
private void processAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
newAnnotation
Annotation newAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
newParameterAnnotation
ParameterAnnotation newParameterAnnotation(int parameter, AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
newTypeAnnotation
TypeAnnotation newTypeAnnotation(TypeAnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
annotationValues
private java.util.Map<java.lang.String,java.lang.Object> annotationValues(ElementValueInfo[] values, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
processElementValue
private void processElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
newElementValue
private java.lang.Object newElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
-
processBootstrapMethods
private void processBootstrapMethods(BootstrapMethodsAttribute attribute)
-
processStackMapTable
private void processStackMapTable(StackMapTableAttribute attribute)
-
verification_type_info
private void verification_type_info(StackMapTableAttribute.VerificationTypeInfo verificationTypeInfo)
-
referTo
private void referTo(Descriptors.TypeRef typeRef, int modifiers)
Add a new package reference.
-
referTo
private void referTo(java.lang.String descriptor, int modifiers)
-
parseDescriptor
@Deprecated public void parseDescriptor(java.lang.String descriptor, int modifiers)Deprecated.This method parses method or field descriptors and callsreferTo(TypeRef, int)for any types found therein.- Parameters:
descriptor- The to be parsed descriptormodifiers-- See Also:
- "https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.3"
-
getReferred
public java.util.Set<Descriptors.PackageRef> getReferred()
-
getAbsolutePath
public java.lang.String getAbsolutePath()
-
reset
@Deprecated public void reset()
Deprecated.
-
typeStream
private java.util.stream.Stream<Descriptors.TypeRef> typeStream(Analyzer analyzer, java.util.function.Function<? super Clazz,java.util.Collection<? extends Descriptors.TypeRef>> func, java.util.Set<Descriptors.TypeRef> visited)
-
is
public boolean is(Clazz.QUERY query, Instruction instr, Analyzer analyzer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isPublic
public boolean isPublic()
-
isProtected
public boolean isProtected()
-
isEnum
public boolean isEnum()
-
isSynthetic
public boolean isSynthetic()
-
isSynthetic
static boolean isSynthetic(int access)
-
isModule
public boolean isModule()
-
isModule
static boolean isModule(int access)
-
isEnum
static boolean isEnum(int access)
-
getFormat
public Clazz.JAVA getFormat()
-
objectDescriptorToFQN
public static java.lang.String objectDescriptorToFQN(java.lang.String string)
-
unCamel
public static java.lang.String unCamel(java.lang.String id)
-
isInterface
public boolean isInterface()
-
isAbstract
public boolean isAbstract()
-
hasPublicNoArgsConstructor
public boolean hasPublicNoArgsConstructor()
-
getAccess
public int getAccess()
-
setInnerAccess
@Deprecated public void setInnerAccess(int access)
Deprecated.
-
annotations
public java.util.stream.Stream<Annotation> annotations(java.lang.String binaryNameFilter)
-
typeAnnotations
public java.util.stream.Stream<TypeAnnotation> typeAnnotations(java.lang.String binaryNameFilter)
-
getClassName
public Descriptors.TypeRef getClassName()
-
isInnerClass
public boolean isInnerClass()
-
getMethodDef
@Deprecated public Clazz.MethodDef getMethodDef(int access, java.lang.String name, java.lang.String descriptor)
Deprecated.
-
getSuper
public Descriptors.TypeRef getSuper()
-
getFQN
public java.lang.String getFQN()
-
getInterfaces
public Descriptors.TypeRef[] getInterfaces()
-
interfaces
public java.util.List<Descriptors.TypeRef> interfaces()
-
annotations
public java.util.Set<Descriptors.TypeRef> annotations()
-
isFinal
public boolean isFinal()
-
setDeprecated
@Deprecated public void setDeprecated(boolean b)
Deprecated.
-
isDeprecated
public boolean isDeprecated()
-
isAnnotation
public boolean isAnnotation()
-
isAnnotation
static boolean isAnnotation(int access)
-
getAPIUses
public java.util.Set<Descriptors.PackageRef> getAPIUses()
-
getExtends
public Clazz.TypeDef getExtends(Descriptors.TypeRef type)
-
getImplements
public Clazz.TypeDef getImplements(Descriptors.TypeRef type)
-
classConstRef
private void classConstRef(int index)
-
classConstRef
private void classConstRef(java.lang.String name)
-
getClassSignature
public java.lang.String getClassSignature()
-
getSourceFile
public java.lang.String getSourceFile()
-
getDefaults
public java.util.Map<java.lang.String,java.lang.Object> getDefaults() throws java.lang.Exception- Throws:
java.lang.Exception
-
getResource
public Resource getResource()
-
-