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

Bug 358194

Summary: Delegate cannot compare to null
Product: z_Archived Reporter: Huang Ji Yong <hjiyong>
Component: EDTAssignee: Paul Harmon <pharmon>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: greer, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Huang Ji Yong CLA 2011-09-20 04:10:29 EDT
Build Version: 201109192102

Create a RUIHandler contains the following code will have compile error and generates the below errors. The problem is in this statement if(myDelegate==null): delegate cannot compare with null(equal or not equal).
Null is parsed as StructPart type, is this the problem?

-- TestCase --
Delegate myDelegate() end
handler testNull type RUIhandler{initialUI =[ ], onConstructionFunction = start, cssFile = "css/testIR.css", title = "testNull"}

	myDelegate MyDelegate?;
    function start()
    	if(myDelegate==null)
    		syslib.writeStdout("compare to null");
    	end
    end
end
-- Errors --
Caused by: java.lang.ClassCastException: org.eclipse.edt.mof.egl.impl.DelegateImpl incompatible with org.eclipse.edt.mof.egl.StructPart
	at org.eclipse.edt.mof.egl.utils.TypeUtils.areCompatible(TypeUtils.java:264)
	at org.eclipse.edt.mof.egl.utils.TypeUtils.getBestFitFunctionMember(TypeUtils.java:846)
	at org.eclipse.edt.mof.egl.utils.TypeUtils.getBestFitOperation(TypeUtils.java:801)
	at org.eclipse.edt.mof.egl.utils.IRUtils.primGetNoConversionBinaryOperation(IRUtils.java:671)
	at org.eclipse.edt.mof.egl.utils.IRUtils.getNoConversionBinaryOperation(IRUtils.java:646)
	at org.eclipse.edt.mof.egl.utils.IRUtils.primGetBinaryOperation(IRUtils.java:732)
	at org.eclipse.edt.mof.egl.utils.IRUtils.getBinaryOperation(IRUtils.java:691)
	at org.eclipse.edt.mof.egl.impl.BinaryExpressionImpl.resolveOperation(BinaryExpressionImpl.java:60)
	at org.eclipse.edt.mof.egl.impl.MultiOperandExpressionImpl.getOperation(MultiOperandExpressionImpl.java:43)
	at org.eclipse.edt.mof.egl.impl.MultiOperandExpressionImpl.getType(MultiOperandExpressionImpl.java:58)
	at org.eclipse.edt.mof.egl.impl.BinaryExpressionImpl.resolveOperation(BinaryExpressionImpl.java:60)
	at org.eclipse.edt.mof.egl.impl.MultiOperandExpressionImpl.getOperation(MultiOperandExpressionImpl.java:43)
	at org.eclipse.edt.mof.egl.impl.MultiOperandExpressionImpl.getType(MultiOperandExpressionImpl.java:58)
	at org.eclipse.edt.mof.egl.utils.IRUtils.makeExprCompatibleToType(IRUtils.java:423)
	at org.eclipse.edt.gen.javascript.templates.IfStatementTemplate.genStatementBody(IfStatementTemplate.java:30)
	at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.edt.mof.codegen.api.TemplateContext.doInvoke(TemplateContext.java:357)

Reproducible: always
Comment 1 Huang Ji Yong CLA 2011-09-20 04:36:18 EDT
Tooltip.egl,DataGrid.egl, Controller.egl, FormManager.egl, ValidationForm.egl are suffering from this defect.
Comment 2 Paul Harmon CLA 2011-09-20 10:45:48 EDT
i have updated TypeUtils to fix this
Comment 3 Huang Ji Yong CLA 2011-09-26 03:57:51 EDT
Verified in build 201109242101