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

Bug 344765

Summary: An inferred type defined across multiple files has its sub-hierarchy built twice
Product: [WebTools] JSDT Reporter: Chris Jaun <cmjaun>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: ccc
Version: 3.2.4Flags: thatnitind: review+
Target Milestone: 3.2.4+   
Hardware: PC   
OS: Windows XP   
Whiteboard: WI74362
Bug Depends on:    
Bug Blocks: 346001    
Attachments:
Description Flags
patch none

Description Chris Jaun CLA 2011-05-04 17:03:11 EDT
Types in JavaScript can have methods/fields added to them across multiple files.

The hierarchy builder works with ITypes and caches things based on iType (the first one it finds). This can be a problem if the methods/fields we are interested in happen to be in a different iType.

There is some code in the hierarchy builder that incorrectly checks the cache for a InferredType and claims it is not in there because it is using a different iType to search the cache than the one that is stored in there. This causes duplicate sub-type hierarchies to be built...this is a pretty big performance hit.

In the long-term we really need to fix the Hierarchy code to understand how JavaScript handles types, but in the short term we can comment out a bit of code and prevent duplicate hierarchy builds.
Comment 1 Chris Jaun CLA 2011-05-04 17:04:32 EDT
Created attachment 194769 [details]
patch
Comment 2 Nitin Dahyabhai CLA 2011-05-05 14:38:52 EDT
It's a little clearer if you understand that the ITypes also have the same names, just different properties defined from different files.  Changing the TypeHierarchy class to properly work based on the type's name rather than an IType instance would make for a much larger change.
Comment 3 Carl Anderson CLA 2011-05-16 21:24:47 EDT
Committed to R3_2_4_patches