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

Bug 368577

Summary: No validation error when trying to invoke missing setter for @Property
Product: z_Archived Reporter: Brian Svihovec <svihovec>
Component: EDTAssignee: Project Inbox <edt.compiler-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jspadea, pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 356388, 368575    
Bug Blocks: 363656    

Description Brian Svihovec CLA 2012-01-13 13:55:59 EST
+++ This bug was initially created as a clone of Bug #368575 +++

i int{@Property{getMethod = "getI"}};

function getI()returns(int)
end

function foo()
  i = 2; // Error
end

I should get a validation error if I try to assign a value to 'i', because there is no setter defined in the @Property annotation.  Currently, no validation message is issued.
Comment 1 Paul Harmon CLA 2012-02-22 15:47:28 EST
It is hard to tell, since this is not a full testcase, but it looks like the testcase may be invalid. Matt says that the property annotation is not honored everywhere. It is only honored when it appears on a field of an external type. The following full testcase should show the problem:

externaltype javatype type javaobject
	a int {@property{getmethod = "geta"}};
	b int;
end

externaltype jstype type javascriptobject
	a int {@property{getmethod = "geta"}};
	b int;
end

library lib1

	field1 javatype;
	field2 jstype;
	
	function f1()
		field1.a = 3; //1 invalid
		field1.b = 3; //0
		field2.a = 3; //1 invalid
		field2.b = 3; //0
	end
end
Comment 2 Paul Harmon CLA 2012-02-23 12:34:27 EST
The code was looking for the wrong annotation and the wrong package. The following classes were updated:

JavaObjectFieldAccessValidator
JavaScriptObjectFieldAccessValidator
Comment 3 Brian Svihovec CLA 2012-04-02 13:05:02 EDT
Verified in Version: 0.8.0.v201203300902-1DV-FjuJ6QMOF4nynxT88h8G.