Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

JDT Core Programmer Guide

Draft Content
This page is currently under construction. Community members are encouraged to maintain the page, and make sure the information is accurate.


The purpose of this document is give insight into JDT Core internals.

If you're looking for information on JDT APIs you should start by visiting the JDT Core section in Eclipse Help. You can also check How to Train the JDT Dragon presentation by Ayushman Jain and Stephan Herrmann. Instructions for the tutorial can be found here.

Many issues of working with JDT/Core source code are covered in the JDT_Core_Committer_FAQ, specifically:

  • The Coding section covers getting the code from git and getting it to compile in your workspace

If the answer to your question is neither there nor here, ask the question.


Java Model

Java model is a lightweight model for views.

Search Engine

Indexes of declarations, references and type hierarchy relationships.

Searching steps

  1. #Indexing phase
  2. Get the file names from indexes
  3. Validate the scope
  4. Parse the file and find out matching nodes
  5. Resolve types (see CompilationUnitDeclaration#resolve()) and narrow down matches reported from index
  6. Create the appropriate model element and call the requestor


For information about the new index, see this page As of bug 572978 the "new index" has been removed.

Information about the legacy actual index:

  • Stored in files in workspace/.metadata/org.eclipse.jdt.core
  • Separate index file for each class path entry (shared across projects)
  • Dedicated daemon thread
  • Names of declaration and references of JavaElements used in the file are stored in the index
  • First stored in Memory and then goes into the Disk
    • In Memory “fileName->category->names”
    • In Disk “Category->names->fileName”
  • For jars, .class files are read (even if source is available)
  • References are read from the constant pool

See also JDT Core Programmer Guide/MetaIndex

Precise and non-precise matches

If there is a search result for the given pattern, but a problem (e.g. errors in code, incomplete class path) occurred, the match is considered as inaccurate.

Inaccurate matches used to be called potential matches and as such can still be seen in the tests and tracing messages.

Using the APIs, an example

Create a search pattern:

SearchPattern pattern = SearchPattern.createPattern(
 "foo(*) int", 

Create a search scope:

IJavaSearchScope scope = SearchEngine.createWorkspaceScope();

Collect results using SearchRequestor subclass:

SearchRequestor requestor = new SearchRequestor() {
 public void acceptSearchMatch(SearchMatch match) {

Start search:

new SearchEngine().search(
 new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant()}, 
 null /*progress monitor*/


Precise, fully resolved compiler parse tree.


See -> /ECJ.


Unit tests

To run unit tests follow the instructions under JDT_Core_Committer_FAQ#Unit_Testing.

New Java Search tests should be added to JavaSearchBugsTests2.

Performance tests

To run performance tests you need to have the following projects in your workspace:

  • org.eclipse.jdt.core.tests.performance
  • org.eclipse.jdt.core.tests.binaries
  • org.eclipse.test.performance
  • org.eclipse.test.performance.win32 (if you're on Windows)

More info about obtaining the JDT/Core source code can be found here: JDT_Core_Committer_FAQ#Where_is_the_JDT.2FCore_code.3F.

Useful VM arguments:

  • -Dmeasures=1 to reduce number of measurements to 1, default is 10
  • -Dprint=true to print more test details on the console
  • -Ddebug=true to print debug info on the console


JDT Core Programmer Guide/CompletionJDT Core Programmer Guide/ECJJDT Core Programmer Guide/ECJ/AST
JDT Core Programmer Guide/ECJ/AnalyseJDT Core Programmer Guide/ECJ/BindingsJDT Core Programmer Guide/ECJ/Generate
JDT Core Programmer Guide/ECJ/InvestigatingJDT Core Programmer Guide/ECJ/LambdaJDT Core Programmer Guide/ECJ/Lookups
JDT Core Programmer Guide/ECJ/ParseJDT Core Programmer Guide/ECJ/TestingJDT Core Programmer Guide/MetaIndex
JDT Core Programmer Guide/suggestions

Back to the top