Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Information about JDT index format
icon3.gif  Information about JDT index format [message #849875] Thu, 19 April 2012 14:25 Go to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
This is a cross post from http:/ /stackoverflow.com/questions/10154325/information-about-jdt-index-format. Deepak Azad recommended that this forum might be the right place.

I'm looking for information about the JDT index. For example what the format is, how the data is structured (Documents? Fields?). Information on that topic seems to be scarce. The ansers to this (http:/ /stackoverflow.com/questions/3898185/how-would-you-access-eclipse-jdt-index) question didn't help yet. Here (http:/ /www.eclipse.org/forums/index.php/mv/tree/63389/#page_top) I found a hint to look for the JavaSearchPattern hierarchy but it's rather hard to understand. I wonder if there is some better, easier to understand, source of information.

Can someone please point me into the right direction?

(I'm not allowed to post links in this forum)
Re: Information about JDT index format [message #850025 is a reply to message #849875] Thu, 19 April 2012 17:31 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

On 4/19/2012 10:25 AM, Tobias Böhm wrote:
> This is a cross post from http:/
> /stackoverflow.com/questions/10154325/information-about-jdt-index-format. Deepak
> Azad recommended that this forum might be the right place.
>
> I'm looking for information about the JDT index. For example what the
> format is, how the data is structured (Documents? Fields?). Information
> on that topic seems to be scarce. The ansers to this (http:/
> /stackoverflow.com/questions/3898185/how-would-you-access-eclipse-jdt-index)
> question didn't help yet. Here (http:/
> /www.eclipse.org/forums/index.php/mv/tree/63389/#page_top) I found a
> hint to look for the JavaSearchPattern hierarchy but it's rather hard to
> understand. I wonder if there is some better, easier to understand,
> source of information.
>
> Can someone please point me into the right direction?
>
> (I'm not allowed to post links in this forum)

Maybe you should be more specific about what you're trying to find out.
Without knowing what problem you're trying to solve, I'm not entirely
sure you're asking the right question.

You might want to look into the SourceIndexerRequestor (and by that I
mean step through it as it's being used), since it is one of the ways
the index is populated.

---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Information about JDT index format [message #850496 is a reply to message #850025] Fri, 20 April 2012 04:50 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Basically the JDT index stores all declarations and references for a given source file. As like Nitin mentioned, step through SourceIndexerRequestor to get an understanding about the things that are getting stored. Look at org.eclipse.jdt.internal.core.index.DiskIndex.writeCategoryTables() to get the file format.
If you want to use the JDT index mechanism as an API look at org.eclipse.jdt.core.search.SearchParticipant.
Re: Information about JDT index format [message #850912 is a reply to message #850496] Fri, 20 April 2012 13:08 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
Thanks.
It's nothing fancy I would like to know. I'm writing my Thesis and am interested in the information that is written to the index. For types, methods, etc.
Also when this artifacts are being indexed. From debugging SourceIndexerRequestor it seems that this happens when saving the file.
Re: Information about JDT index format [message #852077 is a reply to message #850912] Sat, 21 April 2012 16:52 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
Since the indexing process is hard for me to understand, can someone please give me a short overview?
- Is there any structure as to how types, methds, etc are indexed. For example one document per type, one document per method, field, etc?
- What is meant by "no resolved is stored in the index"?
- What is meant by "An index key encodes a reference or a declaration as it appears in
the source"? Does it mean the key is for example the name of a class and behind that key is information of all the places that "key", i.e. that class is referenced?

Thanks
Re: Information about JDT index format [message #853701 is a reply to message #852077] Mon, 23 April 2012 08:58 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Here is an overview of the indexing process. The file is parsed and depending upon the type of the 'name', a key[1] is generated and added into the particular category (eg: type decl, type ref, method decl, method ref,etc). for that file. This is stored in Memory (MemoryIndex.java). Periodically this goes into the disk(DiskIndex.java). Here all documents (file names) are first stored and then all the keys and the offset of the document the particular key is present, are stored in an hashtable.
For eg: the hash table for method declarations could contain elements like this
{foo/1->[0][9]} - means a method of name 'foo' with 1 argument is in documents specified at offset 0 and 9 in the document table.
During the search, a key will be generated depending upon the item to be searched and the indexer will just return the file names that contains the key.

> What is meant by "no resolved is stored in the index"?
'No resolved is stored in the index' means that if for eg: you are using String in your code, the index will not store java.util.String but will only store String. It will not resolve to the item.

Hopefully this helps.

[1] Key is an encoding of the name which can be used for easy searching. Look at *Pattern#createIndexKey() for more information.
Previous Topic:Eclipse preferences problem
Next Topic:Editing library in build path
Goto Forum:
  


Current Time: Fri Apr 26 03:47:28 GMT 2024

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

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

Back to the top