Details
-
Improvement
-
Status: Resolved
-
Medium
-
Resolution: Done
-
None
-
None
Description
We have the following code generated here:
public VlanId(Id _id) {
super();
this._id = _id;
this._enumeration = null;
}
public VlanId(Enumeration _enumeration) {
super();
this._enumeration = _enumeration;
this._id = null;
}
in org.opendaylight.yang.gen.v1.urn.test.rev170101.Cont.java.
This works in general, but it allows invalid objects to be created – if the argument is null, we end up with a union which is neither one or the other:
public VlanId(Id _id) {
super();
this._id = Objects.requireNonNull(_id);
this._enumeration = null;
}
public VlanId(Enumeration _enumeration) {
super();
this._enumeration = Objects.requireNonNull(_enumeration);
this._id = null;
}
Attachments
| # | Subject | Branch | Project | Status | CR | V |
|---|---|---|---|---|---|---|
| 103176,2 | Require union field to be set | master | mdsal | Status: MERGED | +2 | +1 |
| 103180,1 | Require union field to be set | 10.0.x | mdsal | Status: MERGED | +2 | +1 |
| 103608,1 | Remove invalid test in OpenflowPortsUtilTest | stable/chlorine | openflowplugin | Status: MERGED | +2 | +1 |