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

Bug 318004

Summary: NPE during validation in EqualExpression
Product: [WebTools] JSDT Reporter: Chris Jaun <cmjaun>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: andrey.melentyev
Version: 3.2Keywords: needinfo
Target Milestone: 3.2.1Flags: thatnitind: review+
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
patch with junit none

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. ***