[MDSAL-742] Sanititize bits type mapping Created: 11/Apr/22  Updated: 09/Jan/24

Status: Confirmed
Project: mdsal
Component/s: Binding codegen, Binding runtime, Binding Spec
Affects Version/s: None
Fix Version/s: 14.0.0

Type: Epic Priority: Medium
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Name: Evolve bits mapping

 Description   

We map a "bits" type to a dedicated TypeObject. We already have a ScalarTypeObject specialization which has getValue() method.
Examining the generated code for a , it creates this atrocity:

    public static MyBits getDefaultInstance(final String defaultValue) {
        List<String> properties = Lists.newArrayList("bitOne",
        "bitTwo",
        "bitZero"
        );
        if (!properties.contains(defaultValue)) {
            throw new IllegalArgumentException("invalid default parameter");
        }
        int i = 0;
        return new MyBits(
        properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null,
        properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null,
        properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null
        );
    }

There are so many things wrong in this mapping it's not even funny. Let's evolve this thing into something sane in terms of interface modeling, implementation design as well as interactions with runtime.


Generated at Wed Feb 07 20:10:49 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.