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

Bug 349205

Summary: [exceptions] NPE in UnconditionalFlowInfo during Validation
Product: [WebTools] JSDT Reporter: Ian Tewksbury <itewksbu>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2.4Flags: thatnitind: review+
Target Milestone: 3.2.5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 351344    
Attachments:
Description Flags
patch none

Description Ian Tewksbury CLA 2011-06-13 11:57:14 EDT
While a JSDT validation was taken place an error dialog opened with the error below.

I have the patch fro bug 348934 applied.

Errors running builder 'JavaScript Validator' on project 'Dojo'.

java.lang.NullPointerException
at org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo.getLocalID(UnconditionalFlowInfo.java:1706)
at org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo.markAsDefinitelyAssigned(UnconditionalFlowInfo.java:1161)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:79)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:109)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.analyseCode(FunctionExpression.java:73)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.analyseCode(ObjectLiteralField.java:78)
at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.analyseCode(ObjectLiteral.java:97)
at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.analyseAssignment(FieldReference.java:91)
at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.analyseCode(Assignment.java:63)
at org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration.analyseCode(LocalDeclaration.java:73)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:91)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:109)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.analyseCode(FunctionExpression.java:73)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:86)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:155)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:606)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:356)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:288)
at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:86)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:254)
at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:58)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:291)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:199)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Nitin Dahyabhai CLA 2011-06-13 13:12:55 EDT
If you can, attach the file that triggers the problem.
Comment 2 Ian Tewksbury CLA 2011-06-13 13:16:18 EDT
How am I to know which file caused the issue?
Comment 3 Chris Jaun CLA 2011-06-16 12:58:49 EDT
Created attachment 198134 [details]
patch

The same method argument was being resolved twice when the method was part of an assignment statement.

sameVar = function(arg) {}

It was being correctly resolved and having its declaringScope set when the "expression" part of the statement was resolved.

When it tried to resolve the left hand side, it attempts to find the method in the current source type binding and in the process tries to resolve the method again. This time it overwrites any existing binding on the argument, which is not necessary. The overwritten binding never gets its decalaringScope set.

Added a check to only recreate the bidning for the function argument if it does not already exist.
Comment 4 Chris Jaun CLA 2011-06-17 14:44:41 EDT
Checked into HEAD and 3.2.5.