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

Bug 361944

Summary: NullPointerException when "Requesting JavaScript AST from selection"
Product: [WebTools] JSDT Reporter: Marshall Scorcio <marshall.scorcio>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: CLOSED DUPLICATE QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3    
Version: 3.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Marshall Scorcio CLA 2011-10-25 11:35:21 EDT
I recently upgraded to Eclipse 3.7.1, JSDT 1.3.1.v201108102009, and Eclipse WDT 3.3.1.v201107072200. After the upgrade I've been getting "'Requesting JavaScript AST from selection' has encountered a problem" dialogs when editing JavaScript files. 

I am able to consistently reproduce a specific case where clicking on "return" in a function that returns a string literal will cause a NullPointerException. It seems to only happen the first time you click on "return" after opening the file.

Steps to Reproduce:
1. In a JavaScript project, create a file named foo.js with the following contents:
function foo() {
  return "bar";
}

2. Open up foo.js with the JavaScript editor.

3. Click on the keyword "return".

Actual Result:
A dialog appears with the title "Problem Occurred" is displayed that says:
An internal error occurred during: "Requesting JavaScript AST from selection".
java.lang.NullPointerException

Expected Result:
No error should occur.
Comment 1 Nitin Dahyabhai CLA 2012-02-02 15:48:37 EST

*** This bug has been marked as a duplicate of bug 342461 ***