aQute.bnd.osgi
Class Clazz
java.lang.Object
aQute.bnd.osgi.Clazz
public class Clazz
- extends Object
|
Method Summary |
protected void |
constantClass(DataInputStream in,
int poolIndex)
|
protected void |
constantDouble(DataInputStream in,
int poolIndex)
|
protected void |
constantLong(DataInputStream in,
int poolIndex)
|
protected void |
constantUtf8(DataInputStream in,
int poolIndex)
|
protected void |
crawl(byte[] code)
We must find Class.forName references ... |
String |
getAbsolutePath()
|
int |
getAccess()
|
Set<Descriptors.PackageRef> |
getAPIUses()
|
Descriptors.TypeRef |
getClassName()
|
Clazz.TypeDef |
getExtends(Descriptors.TypeRef type)
|
Clazz.JAVA |
getFormat()
|
String |
getFQN()
|
Clazz.TypeDef |
getImplements(Descriptors.TypeRef type)
|
Descriptors.TypeRef[] |
getInterfaces()
|
Clazz.MethodDef |
getMethodDef(int access,
String name,
String descriptor)
To provide an enclosing instance |
Set<Descriptors.PackageRef> |
getReferred()
|
String |
getSourceFile()
|
Descriptors.TypeRef |
getSuper()
|
boolean |
hasPublicNoArgsConstructor()
|
boolean |
is(Clazz.QUERY query,
Instruction instr,
Analyzer analyzer)
|
boolean |
isAbstract()
|
boolean |
isAnnotation()
|
boolean |
isDeprecated()
|
boolean |
isEnum()
|
boolean |
isFinal()
|
boolean |
isInterface()
|
boolean |
isProtected()
|
boolean |
isPublic()
|
protected void |
nameAndType(DataInputStream in,
int poolIndex,
byte tag)
|
static String |
objectDescriptorToFQN(String string)
|
Set<Descriptors.TypeRef> |
parseClassFile()
|
Set<Descriptors.TypeRef> |
parseClassFile(InputStream in)
|
Set<Descriptors.TypeRef> |
parseClassFile(InputStream in,
ClassDataCollector cd)
|
Set<Descriptors.TypeRef> |
parseClassFileWithCollector(ClassDataCollector cd)
|
void |
parseDescriptor(String descriptor,
int modifiers)
This method parses a descriptor and adds the package of the descriptor to
the referenced packages. |
protected void |
pool(Object[] pool,
int[] intPool)
|
void |
reset()
.class construct for different compilers sun 1.1 Detect static variable
class$com$acme$MyClass 1.2 " 1.3 " 1.4 " 1.5 ldc_w (class) 1.6 " eclipse
1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 " 1.5 ldc
(class) 1.6 " 1.5 and later is not an issue, sun pre 1.5 is easy to
detect the static variable that decodes the class name. |
void |
setDeprecated(boolean b)
|
void |
setInnerAccess(int access)
|
String |
toString()
|
static String |
unCamel(String id)
|
HAS_ARGUMENT
public static final EnumSet<Clazz.QUERY> HAS_ARGUMENT
NAME_COMPARATOR
public static final Comparator<Clazz> NAME_COMPARATOR
Clazz
public Clazz(Analyzer analyzer,
String path,
Resource resource)
parseClassFile
public Set<Descriptors.TypeRef> parseClassFile()
throws Exception
- Throws:
Exception
parseClassFile
public Set<Descriptors.TypeRef> parseClassFile(InputStream in)
throws Exception
- Throws:
Exception
parseClassFileWithCollector
public Set<Descriptors.TypeRef> parseClassFileWithCollector(ClassDataCollector cd)
throws Exception
- Throws:
Exception
parseClassFile
public Set<Descriptors.TypeRef> parseClassFile(InputStream in,
ClassDataCollector cd)
throws Exception
- Throws:
Exception
pool
protected void pool(Object[] pool,
int[] intPool)
nameAndType
protected void nameAndType(DataInputStream in,
int poolIndex,
byte tag)
throws IOException
- Parameters:
in - poolIndex - tag -
- Throws:
IOException
constantClass
protected void constantClass(DataInputStream in,
int poolIndex)
throws IOException
- Parameters:
in - poolIndex -
- Throws:
IOException
constantDouble
protected void constantDouble(DataInputStream in,
int poolIndex)
throws IOException
- Parameters:
in -
- Throws:
IOException
constantLong
protected void constantLong(DataInputStream in,
int poolIndex)
throws IOException
- Parameters:
in -
- Throws:
IOException
constantUtf8
protected void constantUtf8(DataInputStream in,
int poolIndex)
throws IOException
- Parameters:
in - poolIndex -
- Throws:
IOException
crawl
protected void crawl(byte[] code)
- We must find Class.forName references ...
- Parameters:
code -
parseDescriptor
public void parseDescriptor(String descriptor,
int modifiers)
- This method parses a descriptor and adds the package of the descriptor to
the referenced packages. The syntax of the descriptor is:
descriptor ::= ( '(' reference * ')' )? reference
reference ::= 'L' classname ( '<' references '>' )? ';' | 'B' | 'Z' | ... | '+' | '-' | '['
This methods uses heavy recursion to parse the descriptor and a roving
pointer to limit the creation of string objects.
- Parameters:
descriptor - The to be parsed descriptorrover - The pointer to start at
getReferred
public Set<Descriptors.PackageRef> getReferred()
getAbsolutePath
public String getAbsolutePath()
getSourceFile
public String getSourceFile()
reset
public void reset()
- .class construct for different compilers sun 1.1 Detect static variable
class$com$acme$MyClass 1.2 " 1.3 " 1.4 " 1.5 ldc_w (class) 1.6 " eclipse
1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 " 1.5 ldc
(class) 1.6 " 1.5 and later is not an issue, sun pre 1.5 is easy to
detect the static variable that decodes the class name. For eclipse, the
class$0 gives away we have a reference encoded in a string.
compilerversions/compilerversions.jar contains test versions of all
versions/compilers.
is
public boolean is(Clazz.QUERY query,
Instruction instr,
Analyzer analyzer)
throws Exception
- Throws:
Exception
toString
public String toString()
- Overrides:
toString in class Object
isPublic
public boolean isPublic()
isProtected
public boolean isProtected()
isEnum
public boolean isEnum()
getFormat
public Clazz.JAVA getFormat()
objectDescriptorToFQN
public static String objectDescriptorToFQN(String string)
unCamel
public static String unCamel(String id)
isInterface
public boolean isInterface()
isAbstract
public boolean isAbstract()
hasPublicNoArgsConstructor
public boolean hasPublicNoArgsConstructor()
getAccess
public int getAccess()
getClassName
public Descriptors.TypeRef getClassName()
getMethodDef
public Clazz.MethodDef getMethodDef(int access,
String name,
String descriptor)
- To provide an enclosing instance
- Parameters:
access - name - descriptor -
- Returns:
getSuper
public Descriptors.TypeRef getSuper()
getFQN
public String getFQN()
getInterfaces
public Descriptors.TypeRef[] getInterfaces()
setInnerAccess
public void setInnerAccess(int access)
isFinal
public boolean isFinal()
setDeprecated
public void setDeprecated(boolean b)
isDeprecated
public boolean isDeprecated()
isAnnotation
public boolean isAnnotation()
getAPIUses
public Set<Descriptors.PackageRef> getAPIUses()
getExtends
public Clazz.TypeDef getExtends(Descriptors.TypeRef type)
getImplements
public Clazz.TypeDef getImplements(Descriptors.TypeRef type)
Copyright © 2014 aQute SARL. All rights reserved.