Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Search Java Index for all constructors of a specific type(Efficient way to perfrom search for all constructors constrained by a type rather than a string prefix or pattern)
Search Java Index for all constructors of a specific type [message #1733892] Wed, 01 June 2016 17:12 Go to next message
Eclipse UserFriend
Consider a content assist use case:
List<String> l = new <Ctrl-Space>

There are only a few completion proposals returned: List() anonymous class constructor and a few proposals bound to the current type.

I'd like to search for all constructors in the index constrained to subtypes of java.util.List

I've tried the following:
IJavaSearchScope hierarchyScope = new HierarchyScope(javaProject, expectedType, DefaultWorkingCopyOwner.PRIMARY, true, false, false);

/*
* Search term is '*' meaning everything, i.e. any prefix
*/
new BasicSearchEngine().searchAllConstructorDeclarations(null, "*".toCharArray(), SearchPattern.R_PATTERN_MATCH, myRestrictedAccessConstructorRequestor)

This works, however building hierarchy scope seem to be a time consuming operation such that sometimes my content assist prposal computer times out. The thread dump indicates that hierarchy scope initialization takes a long time.

QUESTION:
Any better suggestions for accomplishing the above search?
I've been told that JDT has some improvements around indexing... Thus, there might be some other APIs that would help me calculating the hierarchy faster or perform type constrained searches on index more efficiently?
Re: Search Java Index for all constructors of a specific type [message #1734396 is a reply to message #1733892] Tue, 07 June 2016 17:20 Go to previous message
Eclipse UserFriend
You are waiting for https://bugs.eclipse.org/bugs/show_bug.cgi?id=481796 (not included in Neon).
Previous Topic:An apparent bug in the Eclipse compiler for Java 8
Next Topic:Get an IType's type signature?
Goto Forum:
  


Current Time: Thu Jun 19 00:22:13 EDT 2025

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

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

Back to the top