Bug 541625 - Searching for subtypes does not terminate when using FORCE_IMMEDIATE_SEARCH
Summary: Searching for subtypes does not terminate when using FORCE_IMMEDIATE_SEARCH
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-28 04:58 EST by Carsten Pfeiffer CLA
Modified: 2022-12-15 13:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Pfeiffer CLA 2018-11-28 04:58:40 EST
We have the following code:

import org.eclipse.jdt.core.search.*;

new SearchEngine().searchAllTypeNames(
		aPackage,
		SearchPattern.R_EXACT_MATCH,
		aTypePrefix,
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
		IJavaSearchConstants.TYPE,
		aScope,
		aRequestor,
		IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH,
//					IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
		null
);


When we pass FORCE_IMMEDIATE_SEARCH, JobManager.performConcurrentJob() will call disable() to pause indexing. SearchPattern.acceptMatch() however asks the HierarchyScope, which spawns a CreateTypeHierarchyOperation, and IndexBasedHierarchyBuilder.determinePossibleSubTypes() starts another Job, using the hardcoded flag WAIT_UNTIL_READY_TO_SEARCH.

Since the JobManager is disabled, it will wait forever to get scheduled.

So maybe the initial waitingPolicy needs to be forwarded to the hierarchy creation job.

Thread.sleep(long) line: not available [native method]	
IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor) line: 248	
IndexBasedHierarchyBuilder.legacySearchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 664	
IndexBasedHierarchyBuilder.searchAllPossibleSubTypes(IType, IJavaSearchScope, Map, IPathRequestor, int, IProgressMonitor) line: 501	
IndexBasedHierarchyBuilder.determinePossibleSubTypes(HashSet, IProgressMonitor) line: 453	
IndexBasedHierarchyBuilder.build(boolean) line: 154	
TypeHierarchy.compute() line: 320	
TypeHierarchy.refresh(IProgressMonitor) line: 1316	
CreateTypeHierarchyOperation.executeOperation() line: 91	
CreateTypeHierarchyOperation(JavaModelOperation).run(IProgressMonitor) line: 733	
CreateTypeHierarchyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 799	
BinaryType.newTypeHierarchy(IJavaProject, WorkingCopyOwner, IProgressMonitor) line: 838	
HierarchyScope.initialize(IProgressMonitor) line: 436	
HierarchyScope.encloses(String, IProgressMonitor) line: 272	
TypeDeclarationPattern(SearchPattern).acceptMatch(String, String, char, SearchPattern, IndexQueryRequestor, SearchParticipant, IJavaSearchScope, IProgressMonitor) line: 330	
TypeDeclarationPattern(SearchPattern).findIndexMatches(Index, IndexQueryRequestor, SearchParticipant, IJavaSearchScope, IProgressMonitor) line: 2404	
MatchLocator.findIndexMatches(SearchPattern, Index, IndexQueryRequestor, SearchParticipant, IJavaSearchScope, IProgressMonitor) line: 293	
PatternSearchJob.search(Index, IProgressMonitor) line: 114	
PatternSearchJob.execute(IProgressMonitor) line: 69	
IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor) line: 187	
BasicSearchEngine.searchAllTypeNames(char[], int, char[], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor) line: 1848	
SearchEngine.searchAllTypeNames(char[], int, char[], int, int, IJavaSearchScope, TypeNameMatchRequestor, int, IProgressMonitor) line: 1199	
JavaSearchUtil.findTypesByPrefix(String, String, IJavaSearchScope, boolean) line: 93
Comment 1 Eclipse Genie CLA 2020-11-18 02:33:14 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Eclipse Genie CLA 2022-12-15 13:12:26 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.