[Java Parser] For structural exploration

Göran Hultgren gohu at rocketmail.com
Tue Mar 12 12:00:25 UTC 2002


Hi Rob and all!

--- rwithers12 at attbi.com wrote:
> Hi Göran,
> 
> I would be most interested in your code.  So,
> 
> odel-odel-odel-ah-he-hue!

That will do! :-)

> Well, that's supposed to be my Holler.  :-]   Seriously, Göran, this
> would be a huge help in understanding inheritence, and hopefully
> interface facets, of some java code I have.  I am even tempted to take a
> tangent into this area of analysis, at somewhat of a medium scale
> archetecture level, no matter the language.  There is some code (
> Codecrawler? ) that does something like this.

I will send you a zip.

It's code that I wrote for a customer for analysis and enforcement of modularity. It loads a
source tree and constructs instances of JavaFile, JavaClass, JavaInterface, JavaPackage etc. It
does not create any methods though, but that can probably be added easily. More importantly it
also parses full dependency info that Jikes can produce and thus complements the model with
complete dependencies. I have for example some code that rewrites the import-clauses in the source
files to be "exactly right".

The main functionality is that you can declare "modules" - subsets of the packages/classes that
the code then aggregates dependencies for. You can then generate reports summarizing the
dependencies between the modules you defined. By adding rules for what modules different modules
are allowed to depend on you can "rerun" this thing regularly and get reports on any "breakage" of
the dictated rules.

It works pretty good even though there might be some problems with really complicated inner
classes etc. I don't remember exactly but I think I made a kludge that worked for 99% of the time
- the code base I ran it on had A LOT of nested inner classes etc. and it seemed to get it right.

I also actually wrote a small article about it: http://www.bluefish.se/aquarium/jdepper.html
It's in swedish (sorry), but you can still see some samle module definitions and some report
output.

I am currently home sick - but I will probably go to work tomorrow. I will check if I have this
here at home, otherwise you have it in say 24 hours.

regards, Göran

=====
Göran Hultgren, goran.hultgren at bluefish.se
GSM: +46 70 3933950, http://www.bluefish.se
"Department of Redundancy department." -- ThinkGeek

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/



More information about the Squeak-dev mailing list