Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349205 - [exceptions] NPE in UnconditionalFlowInfo during Validation
Summary: [exceptions] NPE in UnconditionalFlowInfo during Validation
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.5   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 351344
  Show dependency tree
 
Reported: 2011-06-13 11:57 EDT by Ian Tewksbury CLA
Modified: 2011-09-23 11:40 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (924 bytes, patch)
2011-06-16 12:58 EDT, Chris Jaun CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.