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 class
Clazz.Assoc
Deprecated.class
Clazz.ClassConstant
Deprecated.(package private) class
Clazz.ClassDef
(package private) class
Clazz.CodeDef
class
Clazz.Def
(package private) class
Clazz.ElementDef
class
Clazz.FieldDef
static class
Clazz.JAVA
class
Clazz.MethodDef
static class
Clazz.MethodParameter
static class
Clazz.QUERY
class
Clazz.TypeDef
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
ACC_BRIDGE
(package private) static int
ACC_SYNTHETIC
(package private) Analyzer
analyzer
private java.util.Set<Descriptors.TypeRef>
annotations
private java.util.Set<Descriptors.PackageRef>
api
private int
class$
(package private) Clazz.ClassDef
classDef
private ClassFile
classFile
private ConstantPool
constantPool
private int
forName
static java.util.EnumSet<Clazz.QUERY>
HAS_ARGUMENT
private boolean
hasClassAnnotations
private boolean
hasDefaultConstructor
private boolean
hasRuntimeAnnotations
private java.util.Set<Descriptors.PackageRef>
imports
private Descriptors.TypeRef[]
interfaces
private static org.slf4j.Logger
logger
static java.util.Comparator<Clazz>
NAME_COMPARATOR
(package private) java.lang.String
path
private java.util.Map<Descriptors.TypeRef,java.lang.Integer>
referred
(package private) Resource
resource
(package private) Descriptors.TypeRef
superClass
static int
TYPEUSE_INDEX_NONE
static int
TYPEUSE_TARGET_INDEX_EXTENDS
private 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.Object
annotationDefault(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 void
classConstRef(int index)
private void
classConstRef(java.lang.String name)
(package private) static Annotation.ElementType
elementType(ClassFile classFile)
(package private) static Annotation.ElementType
elementType(FieldInfo fieldInfo)
(package private) static Annotation.ElementType
elementType(MethodInfo methodInfo)
java.util.stream.Stream<Clazz.FieldDef>
fields()
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.java.lang.String
getAbsolutePath()
int
getAccess()
java.util.Set<Descriptors.PackageRef>
getAPIUses()
Descriptors.TypeRef
getClassName()
java.lang.String
getClassSignature()
java.util.Map<java.lang.String,java.lang.Object>
getDefaults()
Clazz.TypeDef
getExtends(Descriptors.TypeRef type)
Clazz.JAVA
getFormat()
java.lang.String
getFQN()
Clazz.TypeDef
getImplements(Descriptors.TypeRef type)
Descriptors.TypeRef[]
getInterfaces()
Clazz.MethodDef
getMethodDef(int access, java.lang.String name, java.lang.String descriptor)
Deprecated.java.util.Set<Descriptors.PackageRef>
getReferred()
Resource
getResource()
java.lang.String
getSourceFile()
Descriptors.TypeRef
getSuper()
boolean
hasPublicNoArgsConstructor()
private java.util.stream.Stream<Clazz>
hierarchyStream(Analyzer analyzer)
java.util.List<Descriptors.TypeRef>
interfaces()
boolean
is(Clazz.QUERY query, Instruction instr, Analyzer analyzer)
boolean
isAbstract()
boolean
isAnnotation()
(package private) static boolean
isAnnotation(int access)
boolean
isDeprecated()
boolean
isEnum()
boolean
isFinal()
boolean
isInnerClass()
boolean
isInterface()
boolean
isModule()
(package private) static boolean
isModule(int access)
boolean
isProtected()
boolean
isPublic()
boolean
isSynthetic()
(package private) static boolean
isSynthetic(int access)
java.util.stream.Stream<Clazz.MethodDef>
methods()
(package private) Annotation
newAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private java.lang.Object
newElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
(package private) ParameterAnnotation
newParameterAnnotation(int parameter, AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
(package private) TypeAnnotation
newTypeAnnotation(TypeAnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
static java.lang.String
objectDescriptorToFQN(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)
void
parseDescriptor(java.lang.String descriptor, int modifiers)
Deprecated.private void
processAnnotation(AnnotationInfo annotationInfo, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
processAnnotationDefault(AnnotationDefaultAttribute attribute, Annotation.ElementType elementType, int access_flags)
private void
processAnnotations(AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
processAttributes(Attribute[] attributes, Annotation.ElementType elementType, int access_flags)
Called for the attributes in the class, field, method or Code attribute.private void
processBootstrapMethods(BootstrapMethodsAttribute attribute)
private void
processCode(CodeAttribute attribute, Annotation.ElementType elementType)
private void
processElementValue(java.lang.Object value, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
processEnclosingMethod(EnclosingMethodAttribute attribute)
private void
processExceptions(ExceptionsAttribute attribute, int access_flags)
private void
processParameterAnnotations(ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
processSignature(SignatureAttribute attribute, Annotation.ElementType elementType, int access_flags)
private void
processStackMapTable(StackMapTableAttribute attribute)
private void
processTypeAnnotations(TypeAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
referTo(Descriptors.TypeRef typeRef, int modifiers)
Add a new package reference.private void
referTo(java.lang.String descriptor, int modifiers)
void
reset()
Deprecated.void
setDeprecated(boolean b)
Deprecated.void
setInnerAccess(int access)
Deprecated.java.lang.String
toString()
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.String
unCamel(java.lang.String id)
private void
verification_type_info(StackMapTableAttribute.VerificationTypeInfo verificationTypeInfo)
private void
visitAnnotationDefault(ClassDataCollector cd, AnnotationDefaultAttribute attribute, Clazz.ElementDef elementDef)
private void
visitAnnotations(ClassDataCollector cd, AnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
visitAttributes(ClassDataCollector cd, Clazz.ElementDef elementDef)
Called for the attributes in the class, field, or method.private void
visitClassFile(ClassDataCollector cd)
private void
visitCode(ClassDataCollector cd, CodeAttribute attribute, Annotation.ElementType elementType)
private void
visitConstantValue(ClassDataCollector cd, ConstantValueAttribute attribute)
private void
visitEnclosingMethod(ClassDataCollector cd, EnclosingMethodAttribute attribute)
private void
visitInnerClasses(ClassDataCollector cd, InnerClassesAttribute attribute)
private void
visitMethodParameters(ClassDataCollector cd, MethodParametersAttribute attribute, Clazz.ElementDef elementDef)
private void
visitParameterAnnotations(ClassDataCollector cd, ParameterAnnotationsAttribute attribute, Annotation.ElementType elementType, java.lang.annotation.RetentionPolicy policy, int access_flags)
private void
visitReferenceMethod(ClassDataCollector cd, int method_ref_index)
Called when crawling the byte code and a method reference is foundprivate void
visitSignature(ClassDataCollector cd, SignatureAttribute attribute)
private void
visitTypeAnnotations(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.- Parameters:
packageRef
- A '.' delimited package name
-
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:
toString
in 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)
-
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()
-
-