public class Clazz
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Clazz.Assoc |
static class |
Clazz.QUERY |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumSet<Clazz.QUERY> |
HAS_ARGUMENT |
Constructor and Description |
---|
Clazz(java.lang.String path,
Resource resource) |
Modifier and Type | Method and Description |
---|---|
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() |
public static java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
public Clazz(java.lang.String path, Resource resource)
public java.util.Set<java.lang.String> parseClassFile() throws java.io.IOException
java.io.IOException
public java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public java.util.Set<java.lang.String> parseClassFileWithCollector(ClassDataCollector cd) throws java.io.IOException
java.io.IOException
public java.util.Set<java.lang.String> parseClassFile(java.io.InputStream in, ClassDataCollector cd) throws java.io.IOException
java.io.IOException
protected void pool(java.lang.Object[] pool, int[] intPool)
protected void nameAndType(java.io.DataInputStream in, int poolIndex, byte tag) throws java.io.IOException
in
- poolIndex
- tag
- java.io.IOException
protected void constantClass(java.io.DataInputStream in, int poolIndex) throws java.io.IOException
in
- poolIndex
- java.io.IOException
protected void constantDouble(java.io.DataInputStream in, int poolIndex) throws java.io.IOException
in
- java.io.IOException
protected void constantLong(java.io.DataInputStream in, int poolIndex) throws java.io.IOException
in
- java.io.IOException
protected void constantUtf8(java.io.DataInputStream in, int poolIndex) throws java.io.IOException
in
- poolIndex
- java.io.IOException
protected void crawl(byte[] code)
code
- public void parseDescriptor(java.lang.String descriptor)
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.
descriptor
- The to be parsed descriptorrover
- The pointer to start atpublic static java.lang.String getPackage(java.lang.String clazz)
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getReferred()
public java.lang.String getPath()
public java.lang.String getSourceFile()
public void reset()
public boolean is(Clazz.QUERY query, Instruction instr, java.util.Map<java.lang.String,Clazz> classspace)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getFQN()