Search Java Index for all constructors of a specific type [message #1733892] |
Wed, 01 June 2016 21:12 |
Alex Boyko 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?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02591 seconds