Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344765 - An inferred type defined across multiple files has its sub-hierarchy built twice
Summary: An inferred type defined across multiple files has its sub-hierarchy built twice
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.4+   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: WI74362
Keywords:
Depends on:
Blocks: 346001
  Show dependency tree
 
Reported: 2011-05-04 17:03 EDT by Chris Jaun CLA
Modified: 2011-05-16 21:24 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (1.95 KB, patch)
2011-05-04 17:04 EDT, Chris Jaun CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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