Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 21:12 Go to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 9
Registered: May 2016
Junior Member
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 21:20 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
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: Sun Dec 22 06:23:15 GMT 2024

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

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

Back to the top