[YANGTOOLS-200] code generator should not generate this.value = null Created: 02/Jul/14 Updated: 10/Apr/22 Due: 18/Jul/14 Resolved: 21/Jul/14 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Tomas Olvecky | Assignee: | Martin Vitez |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 1276 |
| Description |
|
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress public IpAddress(Ipv4Address _ipv4Address) { super(); this._ipv4Address = _ipv4Address; this._ipv6Address = null; this._value = null; }This constructor is possibly wrong because it returns null on getValue(). If the instance is created using this constructor it cannot be sent over JMX. Consider this example: Proposed fix: _value should be filled using _ipv4Address.getValue() Detail: The failure looks like this: |
| Comments |
| Comment by Maros Marsalek [ 04/Jul/14 ] |
|
In addition, value field is compared in equals method. Equal result depends on which constructor was used for union type. Basic constructors set value to null and Artificial constructor sets the value to input value. |
| Comment by Tomas Olvecky [ 07/Jul/14 ] |
|
this is a bug in code generator (not enhancement) that forces programmers to use workarounds and document them in their code base, see bgpcep, e.g. |
| Comment by Martin Vitez [ 15/Jul/14 ] |
|
Proposed patch: |