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

Bug 354442

Summary: Errors generating when using @EGLProperty
Product: z_Archived Reporter: Justin Spadea <jspadea>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: greer
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=355906
Whiteboard:

Description Justin Spadea CLA 2011-08-10 17:11:11 EDT
In order to reproduce any of this, you need to change the value of Constants.Annotation_EGLProperty to "eglx.lang.EGLProperty".


handler rui1 type RUIhandler {initialUI = [],onConstructionFunction = start, title="rui1"}

	i int{@EGLProperty{getMethod = geti}};
	j int{@EGLProperty{setMethod = setj}};

	function start()
	end
	
	function geti() returns(int)
		return(i);
	end
	function setj(x int)
		j = x;
	end
end

handler rui2 type RUIhandler {initialUI = [],onConstructionFunction = start, cssFile="css/ruiProj.css", title="rui2"}
	function start()
		r rui1{};
		r.j = 33;
		syslib.writestdout(r.i);
	end	
end


rui1 fails on "return(i);" with a CCE
rui2 fails on "r.j = 33;' with the same CCE.
If you comment that line out, it then fails on "syslib.writestdout(r.i);" with the same CCE.

The CCE is trying to cast a MemberNameImpl to a String. I looked at the annotation source and it's indeed a FunctionMemberRef for EGLProperty (and a string for Property).

Finally, the real error in rui1 is that the getter/setter should not be used if accessed within the part that declared the field - otherwise it would get into an infinite loop.
Comment 1 Justin Spadea CLA 2011-08-10 17:13:45 EDT
I took a look at the code, and I think you can ignore my last remark - it does make sure the getter/setter is not the current method.
Comment 2 Justin Spadea CLA 2011-08-10 17:27:04 EDT
Another problem: looks like it defaults to "get<varName>" if you don't specify getMethod, but it doesn't check if such a method exists:

	i int{@EGLProperty{}};
	
	function test() returns(int)
		return(i);
	end

Generated return stmt in test(): return this.getI();

But there is no getI() method.
Comment 3 Scott Greer CLA 2011-08-26 12:09:27 EDT
Justin, 

I believe this has been fixed under https://bugs.eclipse.org/bugs/show_bug.cgi?id=355906    With those changes, your testcase appears to gen correctly.

The other problem you added, that of verifying that a getter/setter actually exists, would be a validation error.  This is something Paul would have to look into, so you should probably split that off into a separate bug....
Comment 4 Justin Spadea CLA 2011-09-08 15:21:45 EDT
Verified