Bug 318004 - NPE during validation in EqualExpression
Summary: NPE during validation in EqualExpression
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: needinfo
: 322139 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-25 11:22 EDT by Chris Jaun CLA
Modified: 2010-08-09 15:54 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (1.06 KB, patch)
2010-06-25 11:24 EDT, Chris Jaun CLA
no flags Details | Diff
patch with junit (2.10 KB, patch)
2010-06-30 10:42 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 Chris Jaun CLA 2010-06-25 11:22:19 EDT
at org.eclipse.wst.jsdt.internal.compiler.ast.EqualExpression.analyseCode(EqualExpression.java:109)
at org.eclipse.wst.jsdt.internal.compiler.ast.AND_AND_Expression.analyseCode(AND_AND_Expression.java:61)
at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.analyseCode(IfStatement.java:70)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.analyseCode(Block.java:48)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.analyseCode(ForStatement.java:146)
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.Block.analyseCode(Block.java:48)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForInStatement.analyseCode(ForInStatement.java:101)
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:110)
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.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.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:589)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:347)
Comment 1 Chris Jaun CLA 2010-06-25 11:24:58 EDT
Created attachment 172768 [details]
patch

If the FieldReference is determined to be a type we should still set its constant field to NotAConstant.
Comment 2 Nitin Dahyabhai CLA 2010-06-25 16:15:19 EDT
Chris, I'd like to see either a unit test for this or at least an example that triggers it without the patch.
Comment 3 Chris Jaun CLA 2010-06-30 10:29:54 EDT
Here is your reproduce code Nitin.

I will add as junit as well...

var obj = {};
obj.first = {};
obj.first.second = function() {};
obj.first.second.prototype = new Object();

if({} != obj.first.second) {
	
}
Comment 4 Chris Jaun CLA 2010-06-30 10:42:12 EDT
Created attachment 173103 [details]
patch with junit
Comment 5 Chris Jaun CLA 2010-06-30 15:58:14 EDT
Patch checked in.
Comment 6 Chris Jaun CLA 2010-08-09 15:54:10 EDT
*** Bug 322139 has been marked as a duplicate of this bug. ***