Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » What kind of information JDT caches about program?
What kind of information JDT caches about program? [message #647254] Wed, 05 January 2011 12:34 Go to next message
Aivar Annamaa is currently offline Aivar AnnamaaFriend
Messages: 33
Registered: July 2009
Member
Hi!

I'm creating a program analysis where I need type hierarchy and call graph, (or some kind of compilation unit dependency graph). Are there some relevant cached data structures collected by JDT that I could use?

How, for example, "call hierarchy" view works? It's not very fast, does it mean it uses SearchEngine each time?

What kind of indexes SearchEngine uses?

Is there some article describing these things?

Aivar

[Updated on: Wed, 05 January 2011 12:36]

Report message to a moderator

Re: What kind of information JDT caches about program? [message #647293 is a reply to message #647254] Wed, 05 January 2011 15:25 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Yes, the call hierarchy view uses the Search Engine. The index manager gives a list of java files where elements of the given name is referenced or declared. The Search Engine parses these files to verify the type of the elements and report the exact line.

JDT also caches Java Models of some java files.
Re: What kind of information JDT caches about program? [message #654469 is a reply to message #647293] Tue, 15 February 2011 22:26 Go to previous messageGo to next message
Aivar Annamaa is currently offline Aivar AnnamaaFriend
Messages: 33
Registered: July 2009
Member
I read (from here: http://www.eclipse.org/articles/Article-Builders/builders.ht ml) that JDT caches references between types.
Quote:
The builder maintains a built state that includes a list of all types (classes or interfaces) that are referenced by each type in the workspace


Any idea, how to access that information?
Re: What kind of information JDT caches about program? [message #654524 is a reply to message #654469] Wed, 16 February 2011 08:23 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
The builder state is not exposed. You could look at org.eclipse.jdt.internal.core.builder.JavaBuilder class. If you could tell us what you want to do, we could probably point you to the right API.
Re: What kind of information JDT caches about program? [message #655048 is a reply to message #654524] Fri, 18 February 2011 07:27 Go to previous message
Aivar Annamaa is currently offline Aivar AnnamaaFriend
Messages: 33
Registered: July 2009
Member
I'm doing string analysis -- trying to collect all possible values of certain string expressions. At one phase I need to find all call-sites for a method. For this I tried to use SearchEngine, but it felt too slow (I want to run the analysis after each file save).

I understand that when I use SearchEngine to locate method references, then it uses some index from identifiers to files to locate possible files, then parses the files and reports the locations. For some reason I get also some invalid matches (correct method name but different signature). Therefore after getting a match, I'm parsing the file again myself to check the validity of the match. If the method is eg. "getName", then lot of files need to be processed and it takes too much time.

Now I'm trying to do without SearchEngine. I begin with parsing and analyzing all files in a project and later parse only files dependent on currently modified files (ie. using types defined in those other files). I'd like to get this dependecy information from JDT.

Ideal solution for me would be that JDT exposes some kind of call-graph that compiler uses, but seems that such thing is not available.

[Updated on: Fri, 18 February 2011 07:30]

Report message to a moderator

Previous Topic:Java 7 Compiler in Eclipse 3.6
Next Topic:Phantom errors (Android)
Goto Forum:
  


Current Time: Thu Apr 25 08:10:51 GMT 2024

Powered by FUDForum. Page generated in 0.03381 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top