Community
Participate
Working Groups
This is a small piece of code that always reproduces the problem: var arr = [1, 2]; for (var i = 0; i < arr.length; i++) { alert(arr[i]); } When I tried this code in a project with a single file (containing this) I get NPE during AST creation. Here is a stack-trace in JSDT core ver. 1.1.4.v201011172326 (I will send another one at HEAD in the next comment): java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.superclass(ArrayBinding.java:197) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findField(Scope.java:461) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getFieldOrMethod(Scope.java:1458) at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.resolveType(FieldReference.java:380) at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.resolveType(FieldReference.java:275) at org.eclipse.wst.jsdt.internal.compiler.ast.BinaryExpression.resolveType(BinaryExpression.java:263) at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolveTypeExpecting(Expression.java:540) at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:274) 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)
Another (probably related) NPE for the same JS code but for JSDT core at HEAD: java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getField(ArrayBinding.java:237) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findField(Scope.java:440) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getFieldOrMethod(Scope.java:1456) at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.resolveType(FieldReference.java:369) at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.resolveType(FieldReference.java:275) at org.eclipse.wst.jsdt.internal.compiler.ast.BinaryExpression.resolveType(BinaryExpression.java:262) at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolveTypeExpecting(Expression.java:538) at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:274) at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:401) 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)
Cannot reproduce in 3.5.