[MDSAL-763] Fix generation of constructor parameters for BitsTypeObject Created: 12/Jul/22 Updated: 18/Jan/24 |
|
| Status: | In Review |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Ivan Martiniak | Assignee: | Ivan Martiniak |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Evolve bits mapping |
| Description |
|
Constructor parameters for BitsTypeObject are generated in the wrong order. Correct order has to be based on the position of individual bits. For this typedef:
typedef my-bits {
type bits {
bit bit-zero {
position 0;
}
bit bit-one {
position 1;
}
bit bit-two {
position 2;
}
}
default "bit-one";
}
We end up emitting: public class MyBits implements BitsTypeObject, Serializable { private static final long serialVersionUID = -6378126414559401958L; private final Boolean _bitZero; private final Boolean _bitOne; private final Boolean _bitTwo; public MyBits(Boolean _bitOne, Boolean _bitTwo, Boolean _bitZero) { this._bitZero = _bitZero; this._bitOne = _bitOne; this._bitTwo = _bitTwo; } } Apart from some kind of illogical arrangement, it causes the wrong assignment of arguments through super(), in the case of restricted bit types. |
| Comments |
| Comment by Robert Varga [ 26/Jun/23 ] |
|
The core identifier here is bit name, not value – a value may reasonably shift. That's by Binding Spec orders bits by their name, not by their position. Now if super() invocations are the problem, that needs to be fixed. |