Bug 317833 - [validation] java.lang.NullPointerException in org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo#markAsDefinitelyNonNull
Summary: [validation] java.lang.NullPointerException in org.eclipse.wst.jsdt.internal....
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.2.2   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: needinfo
: 313327 320203 324814 404228 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-24 10:35 EDT by David Matheson CLA
Modified: 2013-03-25 12:19 EDT (History)
9 users (show)

See Also:
thatnitind: review+


Attachments
Set of JavaScript files to trigger error (180.98 KB, application/zip)
2010-06-30 14:15 EDT, David Matheson CLA
no flags Details
patch (1.67 KB, patch)
2010-08-12 16:16 EDT, Chris Jaun CLA
no flags Details | Diff
Smaller project to reproduce with (93.16 KB, application/zip)
2010-08-12 16:17 EDT, Chris Jaun CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Matheson CLA 2010-06-24 10:35:17 EDT
Build Identifier: 20100617-1415

Even if JavaScript validation is turned off through Validation -> Enable project specific settings -> Client-side JavaScript unchecked for Manual and Build, I get this error frequently when I clean and rebuild my project, often after a change to the filesystem. Stack trace:

!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.wst.jsdt.core 4 75 2010-06-22 09:31:08.017
!MESSAGE Errors running builder 'JavaScript Validator' on project 'dam'.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo.markAsDefinitelyNonNull(UnconditionalFlowInfo.java:1186)
	at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.analyseAssignment(FieldReference.java:80)
	at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.analyseCode(Assignment.java:59)
	at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:155)
	at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:589)
	at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:347)
	at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:286)
	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:225)
	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:194)
	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)

Reproducible: Sometimes

Steps to Reproduce:
Trying to come up with a set of JavaScript files to reproduce.  Sometimes I can trigger it with 80 or so.  I copy them over from my problematic project with JSPs, Java code and JavaScript to an empty project.  I can often generate the error, but it does not seem to be a particular JS file.
Comment 1 Chris Jaun CLA 2010-06-30 11:51:24 EDT
Having a hard time investigating this without any source code to reproduce.

Is there anything you can provide us?
Comment 2 David Matheson CLA 2010-06-30 14:15:12 EDT
Created attachment 173138 [details]
Set of JavaScript files to trigger error
Comment 3 David Matheson CLA 2010-06-30 14:19:30 EDT
See attached file.  Steps to reproduce:

1. Create an empty Dynamic Web Application.
2. Unzip the JavaScript files into the WebContent directory.
3. Refresh the project.
4. Ensure "Build Automatically" is checked.
5. Clean the project.

These steps cause the error for me.


Dave

(In reply to comment #2)
> Created an attachment (id=173138) [details]
> Set of JavaScript files to trigger error
Comment 4 David Matheson CLA 2010-06-30 14:34:22 EDT
I just verified that I have this issue on Mac OSX Snow Leopard, as well.  I followed my own steps to reproduce, and used the javascript.zip provided.
Comment 5 Eduardo Yáñez Parareda CLA 2010-07-12 06:28:00 EDT
It also happens to me on Linux 64bits (Fedora 13).
Comment 6 Michael Rennie CLA 2010-07-14 10:19:23 EDT
Just hit this using a JS project for the first time...on Ubuntu 10.04

java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo.markAsDefinitelyNonNull(UnconditionalFlowInfo.java:1186)
	at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.analyseAssignment(FieldReference.java:80)
	at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.analyseCode(Assignment.java:59)
	at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:155)
	at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:589)
	at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:347)
	at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:286)
	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:225)
	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:194)
	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 7 Chris Jaun CLA 2010-07-14 13:11:04 EDT
*** Bug 319884 has been marked as a duplicate of this bug. ***
Comment 8 Chris Jaun CLA 2010-07-19 10:29:21 EDT
*** Bug 320203 has been marked as a duplicate of this bug. ***
Comment 9 Jack O'Connor CLA 2010-08-03 11:31:05 EDT
Confirm this bug on Ubuntu 10.04

eclipse.buildId=I20100608-0911
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.php.product
Command-line arguments:  -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.php.product -clean


java.lang.NullPointerException
at org.eclipse.wst.jsdt.internal.compiler.ast.ConditionalExpression.analyseCode(ConditionalExpression.java:50)
at org.eclipse.wst.jsdt.internal.compiler.ast.ArrayInitializer.analyseCode(ArrayInitializer.java:42)
at org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration.analyseCode(LocalDeclaration.java:62)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.analyseCode(Block.java:48)
at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:91)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:93)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:108)
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:108)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.analyseCode(FunctionExpression.java:73)
at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.analyseCode(Expression.java:184)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:65)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:155)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:589)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:347)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:286)
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:225)
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 10 Jack O'Connor CLA 2010-08-03 11:42:12 EDT
Also if this is driving you insane, you can completely disable JavaScript Validation for your project by going into it's Properties > Builders section and unchecking the corresponding box.
Comment 11 Chris Jaun CLA 2010-08-10 17:16:36 EDT
(In reply to comment #9)
> Confirm this bug on Ubuntu 10.04
> 
> eclipse.buildId=I20100608-0911
> java.version=1.6.0_18
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_GB
> Framework arguments:  -product org.eclipse.epp.package.php.product
> Command-line arguments:  -os linux -ws gtk -arch x86 -product
> org.eclipse.epp.package.php.product -clean
> 
> 
> java.lang.NullPointerException
> at
> org.eclipse.wst.jsdt.internal.compiler.ast.ConditionalExpression.analyseCode(ConditionalExpression.java:50)


Jack, this bug is being tracked by https://bugs.eclipse.org/bugs/show_bug.cgi?id=318769

However, no one has yet provided me steps to reproduce so no investigation has been done it. If you could provide steps that would be a big help.

Chris
Comment 12 Chris Jaun CLA 2010-08-11 13:26:19 EDT
*** Bug 313327 has been marked as a duplicate of this bug. ***
Comment 13 Chris Jaun CLA 2010-08-12 16:16:35 EDT
Created attachment 176500 [details]
patch
Comment 14 Chris Jaun CLA 2010-08-12 16:17:44 EDT
Created attachment 176502 [details]
Smaller project to reproduce with
Comment 15 Chris Jaun CLA 2010-08-16 18:15:25 EDT
The attached project will reproduce this problem in 3.2.2 builds. You must do a clean build after importing.

The project originally attached works as well.
Comment 16 Nitin Dahyabhai CLA 2010-08-16 20:27:35 EDT
markAsDefinitelyNull and markAsDefinitelyUnknown would also be prone to
this, right?
Comment 17 Chris Jaun CLA 2010-08-17 11:59:26 EDT
(In reply to comment #16)
> markAsDefinitelyNull and markAsDefinitelyUnknown would also be prone to
> this, right?

Yes, they seem to work in the same way.

Would you like me to make a similar fix in those?
Comment 18 Chris Jaun CLA 2010-08-24 16:04:26 EDT
Fixed in 3.2.2 and HEAD.
Comment 19 Chris Jaun CLA 2010-09-09 15:27:34 EDT
*** Bug 324814 has been marked as a duplicate of this bug. ***
Comment 20 Michael Rennie CLA 2013-03-25 12:19:58 EDT
*** Bug 404228 has been marked as a duplicate of this bug. ***