Fix generation of constructor parameters for BitsTypeObject
Description
Environment
None
Activity
Show:
Robert Varga June 26, 2023 at 7:31 PM
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.
Details
Details
Assignee
Ivan Martiniak
Ivan MartiniakReporter
Ivan Martiniak
Ivan MartiniakLabels
Components
Fix versions
Priority
Created July 12, 2022 at 11:07 AM
Updated June 24, 2024 at 8:48 AM
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.