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

Bug 316327

Summary: [model] JavaElement.newNotPresentException exceptions caused by use of IJavaScriptProject#findType
Product: [WebTools] JSDT Reporter: Ian Tewksbury <itewksbu>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: CLOSED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2Flags: cmjaun: review+
thatnitind: review+
Target Milestone: 3.2.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix Patch
none
Fix Patch - Update 1 none

Description Ian Tewksbury CLA 2010-06-09 11:26:39 EDT
Created attachment 171541 [details]
Fix Patch

The problem with IJavaScriptProject#findType is that it returns the first type to match the given FQN but that type may not actully be the one a caller is looking for.  Then if the caller asks for a field they are expecting on the type but its the wrong type a org.eclipse.wst.jsdt.internal.core.JavaElement.newNotPresentException is thrown.

Attached patch changes a couple of these cases I have found to use the #findTypes method to avoid this exception.
Comment 1 Chris Jaun CLA 2010-06-09 14:14:10 EDT
Ian is submitting an updated patch with a few minor updates. I approve.
Comment 2 Ian Tewksbury CLA 2010-06-09 14:15:19 EDT
Created attachment 171562 [details]
Fix Patch - Update 1

Added null safety.
Comment 3 Chris Jaun CLA 2010-06-22 15:42:35 EDT
Fix checked into 3.2.1
Comment 4 Ian Tewksbury CLA 2010-07-09 09:11:32 EDT
verified in WTP 3.2.1