Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368577 - No validation error when trying to invoke missing setter for @Property
Summary: No validation error when trying to invoke missing setter for @Property
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 356388 368575
Blocks: 363656
  Show dependency tree
 
Reported: 2012-01-13 13:55 EST by Brian Svihovec CLA
Modified: 2017-02-23 14:19 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.