aQute.lib.osgi
Class Clazz
java.lang.Object
aQute.lib.osgi.Clazz
public class Clazz
- extends java.lang.Object
|
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 ... |
static java.lang.String |
fqnToBinary(java.lang.String dotted)
|
static java.lang.String |
fqnToPath(java.lang.String dotted)
|
Clazz.JAVA |
getFormat()
|
java.lang.String |
getFQN()
|
static void |
getImplementedPackages(java.util.Set<java.lang.String> implemented,
Analyzer analyzer,
Clazz clazz)
|
static java.lang.String |
getPackage(java.lang.String clazz)
|
java.lang.String |
getPath()
|
java.util.Set<java.lang.String> |
getReferred()
|
static java.lang.String |
getShortName(java.lang.String cname)
|
java.lang.String |
getSourceFile()
|
static java.lang.String |
internalToFqn(java.lang.String string)
|
boolean |
is(Clazz.QUERY query,
Instruction instr,
Analyzer analyzer)
|
boolean |
isEnum()
|
boolean |
isPublic()
|
protected void |
nameAndType(java.io.DataInputStream in,
int poolIndex,
byte tag)
|
static java.lang.String |
objectDescriptorToFQN(java.lang.String string)
|
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. |
static java.lang.String |
pathToFqn(java.lang.String path)
|
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. |
static java.lang.String |
toDescriptor(java.lang.Class<?> clazz)
|
java.lang.String |
toString()
|
static java.lang.String |
unCamel(java.lang.String id)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
HAS_ARGUMENT
public static java.util.EnumSet<Clazz.QUERY> HAS_ARGUMENT
Clazz
public Clazz(java.lang.String path,
Resource resource)
parseClassFile
public java.util.Set<java.lang.String> parseClassFile()
throws java.lang.Exception
- Throws:
java.lang.Exception
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.lang.Exception
- Throws:
java.lang.Exception
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 ::= ( '(' 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
getPackage
public static java.lang.String getPackage(java.lang.String clazz)
getReferred
public java.util.Set<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,
Analyzer analyzer)
throws java.lang.Exception
- Throws:
java.lang.Exception
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
getFQN
public java.lang.String getFQN()
getImplementedPackages
public static void getImplementedPackages(java.util.Set<java.lang.String> implemented,
Analyzer analyzer,
Clazz clazz)
throws java.lang.Exception
- Throws:
java.lang.Exception
toDescriptor
public static java.lang.String toDescriptor(java.lang.Class<?> clazz)
getShortName
public static java.lang.String getShortName(java.lang.String cname)
fqnToPath
public static java.lang.String fqnToPath(java.lang.String dotted)
fqnToBinary
public static java.lang.String fqnToBinary(java.lang.String dotted)
pathToFqn
public static java.lang.String pathToFqn(java.lang.String path)
isPublic
public boolean isPublic()
isEnum
public boolean isEnum()
getFormat
public Clazz.JAVA getFormat()
objectDescriptorToFQN
public static java.lang.String objectDescriptorToFQN(java.lang.String string)
internalToFqn
public static java.lang.String internalToFqn(java.lang.String string)
unCamel
public static java.lang.String unCamel(java.lang.String id)
Copyright å© aQute SARL (2000, 2011). All Rights Reserved.