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

Bug 313620

Summary: NPE in AST when setting a breakpoint on an Array.push
Product: [WebTools] JSDT Reporter: Simon Kaegi <simon_kaegi>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2Keywords: needinfo
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Simon Kaegi CLA 2010-05-19 15:58:57 EDT
With the following script:

var foo = [];
foo.push("x");
foo.push("y");

When I try and set a breakpoint on the line with foo.push("x") I get the following stack showing up in the -debug console. I'm running off of HEAD.

java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getExactMethod(ArrayBinding.java:233)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:401)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1813)
	at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:307)
	at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477)
	at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394)
	at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:859)
	at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:527)
	at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:862)
	at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
	at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
	at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
	at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
	at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Simon Kaegi CLA 2010-05-19 16:22:21 EDT
Also, FWIW this occured in a JavaScript file that was external source so the wrapping project is not a JS project so might not have any useful environment properties set. With that said when debugging this is a fairly common case since the script URI are frequently http based.
Comment 2 Chris Jaun CLA 2010-05-21 17:34:36 EDT
Can you provide me step-by-step instructions to reproduce?
Comment 3 Chris Jaun CLA 2011-04-18 16:26:32 EDT
This should have been fixed by BUG316330.