Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-dev] parsing classfiles contained in a jar

Hi,

I am developing an Eclipse plugin for analyzing (java) source code. To
do so, I simply write ASTVisitors that visit the AST.

However, I also need information about the type, method and attribute
signature of classes contained in jars (and with no source code
available).

I assume that it is unrealistic to expect to construct an AST of the
content of these classfiles. However, as it is possible to have the
signatures of methods contained in such classes displayed in an
Eclipse view, I assume that I should be able to extract the following
information:

a. name of the class
b. names of its superclasses, superinterfaces
c. for each of its methods
c.1 methodname
c.2 qualified type name of the return type
c.3 for each of its parameters
c.3.1 qualified type name of the parameter
c.4 for each of its attributes
c.4.1 attributename
c.4.2 qualified type name of the attribute

My quest so far has lead to the following results:
ToolFactory.createDefaultClassFileReader is able to provide a
ClassFileReader for a given class file, from which one can request
information regarding its methods and fields.
However, this merely results in information about {a, c.1, c.4.1}...

Can anyone provide some information on how to extract this information
from a class-file?

Kind regards,
-- 
Bart Du Bois
PhD student, Lab On Reengineering
Dept. of Mathematics and Computer Science
University of Antwerp

PS: In case anyone is interested: my plugin currently harvests the
AST, fills in a Meta-Data-Repository (MDR) with a metamodel that is
satisfactory for calculating coupling and cohesion metrics, as well as
refactoring preconditions. The goal is to provide advice on where to
apply a specific refactoring in order to improve coupling and
cohesion.


Back to the top