Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330274

Summary: JavaSearchScope#indexOf needs to be updated to deal with package fragment roots enclosed by another package fragment root
Product: [WebTools] JSDT Reporter: Ian Tewksbury <itewksbu>
Component: GeneralAssignee: Ian Tewksbury <itewksbu>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 Flags: thatnitind: review+
Version: 3.2.3   
Target Milestone: 3.2.3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix Patch thatnitind: iplog+

Description Ian Tewksbury CLA 2010-11-15 13:56:18 EST
The JavaScript tooling allows for a package fragment root to be enclosed by another package fragment root.  The JavaSearchScope#indexOf method simply returns the first package fragment root it finds that ecnloses the given path.  The problem is there maybe another package fragment root contained within the first applicable root that is more specific to the given path and thus should be used.

Fix is to update the method to look through all of the possible container paths to find the most specific root for the given path.
Comment 1 Ian Tewksbury CLA 2010-11-15 14:00:14 EST
Created attachment 183149 [details]
Fix Patch

Patch that updates JavaSearchScope#indexOf to find the most specific container path that encloses the given path.

Passes all existing JUnits.
Comment 2 Nitin Dahyabhai CLA 2010-11-17 17:45:17 EST
Committed to 3.2.3 and HEAD, thanks, Ian.
Comment 3 Ian Tewksbury CLA 2010-11-18 08:37:59 EST
I just noticed my comment in this patch is wrong:
//if have not found answer yet or the new answer is not enclosed by the previous answer and is thus more specific

should read
//if have not found answer yet or the new answer is does not enclose the previous answer and is thus more specific