Community
Participate
Working Groups
Build Identifier: 0.7.0.v201111012101 1) Import the H3.egl and opened with VE. 2) Click in the input field, and then click anywhere out of the input field. The 'null' is displayed in the error label, which is different from the RBD. Reproducible: Always
Created attachment 206378 [details] The sample EGL file.
This is a JSGen problem. What MVC is doing is there is a string? field with a null value. It gets assigned to the text field of the widget. The widget's text field is not nullable. It has a setMethod defined for setting the value, and the string parameter in the set method is also not nullable. The generated code is passing in the null value instead of a blank string. If you do an assignment of a nullable string to non-nullable string without a setMethod, it does properly assign a blank value. Testcase: t textlabel{}; function test() s string?; t.text = s; end Generated code: var s = null; this.t.setText(s);
We discussed this today, and a NullValueException should occur here instead of converting null to blank. If you do an assignment of a null string to a non-nullable string field, that too should throw a NullValueException. I've updated the MVC code to check for null before updating the error label, but I'm leaving this open because JSGen is not yet throwing the expected exception. I didn't verify this, but I'm told JavaGen already works this way.
Hi Justin, This test case is about string type. How about assign a null value to an unnullable int type or other types? For example: a int? b int = 5; b = a; Does this case throw a NullValueException?
Yes, this holds true for all types. So when a nullable type is assigned to a non-nullable type, it should be wrapped in egl.checkNull().
Created attachment 207000 [details] Patch to resolve the defect
When assigning a Null value to a non-nullable type will throw NullValueException now.
Verified in 0.7.0.v201111160901.