aQute.lib.osgi

Class Clazz

public class Clazz extends Object

Nested Class Summary
protected static classClazz.Assoc
static classClazz.QUERY
Field Summary
static EnumSet<Clazz.QUERY>HAS_ARGUMENT
Constructor Summary
Clazz(String path, Resource resource)
Method Summary
protected voidconstantClass(DataInputStream in, int poolIndex)
protected voidconstantDouble(DataInputStream in, int poolIndex)
protected voidconstantLong(DataInputStream in, int poolIndex)
protected voidconstantUtf8(DataInputStream in, int poolIndex)
protected voidcrawl(byte[] code)
We must find Class.forName references ...
StringgetFQN()
static StringgetPackage(String clazz)
StringgetPath()
Map<String,Map<String,String>>getReferred()
StringgetSourceFile()
booleanis(Clazz.QUERY query, Instruction instr, Map<String,Clazz> classspace)
protected voidnameAndType(DataInputStream in, int poolIndex, byte tag)
Set<String>parseClassFile()
Set<String>parseClassFile(InputStream in)
Set<String>parseClassFile(InputStream in, ClassDataCollector cd)
Set<String>parseClassFileWithCollector(ClassDataCollector cd)
voidparseDescriptor(String descriptor)
This method parses a descriptor and adds the package of the descriptor to the referenced packages.
protected voidpool(Object[] pool, int[] intPool)
voidreset()
.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.
StringtoString()

Field Detail

HAS_ARGUMENT

public static EnumSet<Clazz.QUERY> HAS_ARGUMENT

Constructor Detail

Clazz

public Clazz(String path, Resource resource)

Method Detail

constantClass

protected void constantClass(DataInputStream in, int poolIndex)

Parameters: in poolIndex

Throws: IOException

constantDouble

protected void constantDouble(DataInputStream in, int poolIndex)

Parameters: in

Throws: IOException

constantLong

protected void constantLong(DataInputStream in, int poolIndex)

Parameters: in

Throws: IOException

constantUtf8

protected void constantUtf8(DataInputStream in, int poolIndex)

Parameters: in poolIndex

Throws: IOException

crawl

protected void crawl(byte[] code)
We must find Class.forName references ...

Parameters: code

getFQN

public String getFQN()

getPackage

public static String getPackage(String clazz)

getPath

public String getPath()

getReferred

public Map<String,Map<String,String>> getReferred()

getSourceFile

public String getSourceFile()

is

public boolean is(Clazz.QUERY query, Instruction instr, Map<String,Clazz> classspace)

nameAndType

protected void nameAndType(DataInputStream in, int poolIndex, byte tag)

Parameters: in poolIndex tag

Throws: IOException

parseClassFile

public Set<String> parseClassFile()

parseClassFile

public Set<String> parseClassFile(InputStream in)

parseClassFile

public Set<String> parseClassFile(InputStream in, ClassDataCollector cd)

parseClassFileWithCollector

public Set<String> parseClassFileWithCollector(ClassDataCollector cd)

parseDescriptor

public void parseDescriptor(String descriptor)
This method parses a descriptor and adds the package of the descriptor to the referenced packages. The syntax of the descriptor is:
   descriptor ::= ( '(' references ')' )? references
   references ::= 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 descriptor rover The pointer to start at

pool

protected void pool(Object[] pool, int[] intPool)

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.

toString

public String toString()