Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to decouple the code indexing capabilities of Eclipse?

I am looking to write a static analyser for a university class. To provide more power for the tool I would like to be able to look up the call hierarchy (as Ctrl+Alt+H does in Eclipse). This would also have to be a fast operation, so the lookup would probably have to be done against an index rather than bytecode scanning.

However, writing an Eclipse plugin would be too ambitious I expect. Instead I would rather decouple the parts of Eclipse which create the code index, and use a library to do lookups. The interface to the user would be on the command line, to simplify implementation.

I read that Eclipse uses Lucene to do the indexing[1], however, there must be a significant amount of work atop Lucene for the capabilities Eclipse allows.

The question is, is it possible to decouple the indexing capabilities of Eclipse for reuse? If not, are there other, readily available libraries available that could do the kind of processing I've discussed?

[1] Lucene In Action (IIRC)


EDIT

I think there's been some misunderstanding. I'm not looking to inspect the class hierarchy, I want to inspect the call hierarchy. That's why searching and indexing (of some kind, though maybe that's not the right term) comes into the discussion. Inspecting the class hierarchy is probably a lot less expensive than inspecting the call hierarchy.

As for writing an Eclipse plugin, yes I'd love to, but given this assignment is on a very short timescale it's probably unlikely I'll manage it. But it's useful information that some of you feel this is not as tough as I think it will be.

Perhaps I have put too much emphasis on Eclipse, it occurred to me I'm really looking for any tool that provides an API for inspecting a call graph through the bytecode.

Thanks for your answers so far!

like image 541
Grundlefleck Avatar asked Nov 05 '09 15:11

Grundlefleck


1 Answers

Walking the byte code is not hard at all and is not slow either. We have performed static analysis of large Java code projects at interactive speeds. Since, you are short on time I would suggest that you modify something like a call graph viewer plugin[1] in eclipse. Also, Eclipse code is hard to comprehend, you are better off writing your own plugin that uses as much of Eclipse's undocumented API's as possible.

[1] http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1326.html

like image 124
mansu Avatar answered Sep 28 '22 08:09

mansu