aQute.lib.osgi
Class Clazz

java.lang.Object
  extended by aQute.lib.osgi.Clazz

public class Clazz
extends java.lang.Object


Nested Class Summary
protected static class Clazz.Assoc
           
static class Clazz.QUERY
           
 
Field Summary
static java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
           
 
Constructor Summary
Clazz(java.lang.String path, Resource resource)
           
 
Method Summary
protected  void constantClass(java.io.DataInputStream in, int poolIndex)
           
protected  void constantDouble(java.io.DataInputStream in, int poolIndex)
           
protected  void constantLong(java.io.DataInputStream in, int poolIndex)
           
protected  void constantUtf8(java.io.DataInputStream in, int poolIndex)
           
protected  void crawl(byte[] code)
          We must find Class.forName references ...
 java.lang.String getFQN()
           
static java.lang.String getPackage(java.lang.String clazz)
           
 java.lang.String getPath()
           
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getReferred()
           
 java.lang.String getSourceFile()
           
 boolean is(Clazz.QUERY query, Instruction instr, java.util.Map<java.lang.String,Clazz> classspace)
           
protected  void nameAndType(java.io.DataInputStream in, int poolIndex, byte tag)
           
 java.util.Set<java.lang.String> parseClassFile()
           
 java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in)
           
 java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in, ClassDataCollector cd)
           
 java.util.Set<java.lang.String> parseClassFileWithCollector(ClassDataCollector cd)
           
 void parseDescriptor(java.lang.String descriptor)
          This method parses a descriptor and adds the package of the descriptor to the referenced packages.
protected  void pool(java.lang.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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HAS_ARGUMENT

public static java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
Constructor Detail

Clazz

public Clazz(java.lang.String path,
             Resource resource)
Method Detail

parseClassFile

public java.util.Set<java.lang.String> parseClassFile()
                                               throws java.io.IOException
Throws:
java.io.IOException

parseClassFile

public java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in)
                                               throws java.io.IOException
Throws:
java.io.IOException

parseClassFileWithCollector

public java.util.Set<java.lang.String> parseClassFileWithCollector(ClassDataCollector cd)
                                                            throws java.io.IOException
Throws:
java.io.IOException

parseClassFile

public java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in,
                                                      ClassDataCollector cd)
                                               throws java.io.IOException
Throws:
java.io.IOException

pool

protected void pool(java.lang.Object[] pool,
                    int[] intPool)

nameAndType

protected void nameAndType(java.io.DataInputStream in,
                           int poolIndex,
                           byte tag)
                    throws java.io.IOException
Parameters:
in -
poolIndex -
tag -
Throws:
java.io.IOException

constantClass

protected void constantClass(java.io.DataInputStream in,
                             int poolIndex)
                      throws java.io.IOException
Parameters:
in -
poolIndex -
Throws:
java.io.IOException

constantDouble

protected void constantDouble(java.io.DataInputStream in,
                              int poolIndex)
                       throws java.io.IOException
Parameters:
in -
Throws:
java.io.IOException

constantLong

protected void constantLong(java.io.DataInputStream in,
                            int poolIndex)
                     throws java.io.IOException
Parameters:
in -
Throws:
java.io.IOException

constantUtf8

protected void constantUtf8(java.io.DataInputStream in,
                            int poolIndex)
                     throws java.io.IOException
Parameters:
in -
poolIndex -
Throws:
java.io.IOException

crawl

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

Parameters:
code -

parseDescriptor

public void parseDescriptor(java.lang.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

getPackage

public static java.lang.String getPackage(java.lang.String clazz)

getReferred

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getReferred()

getPath

public java.lang.String getPath()

getSourceFile

public java.lang.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,
                  java.util.Map<java.lang.String,Clazz> classspace)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getFQN

public java.lang.String getFQN()