[MDSAL-827] Suppress empty range checkers Created: 16/May/23  Updated: 15/Aug/23

Status: In Review
Project: mdsal
Component/s: Binding codegen
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Samuel Schneider
Resolution: Unresolved Votes: 0
Labels: pick-next, pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The following snippet:

typedef timeticks {
  type uint32;
}

results in:

    private final Uint32 _value;

    private static void check_valueRange(final long value) {

    }

    @ConstructorParameters("value")
    public Timeticks(Uint32 _value) {
        if (_value != null) {
            check_valueRange(_value.longValue());
        }

        CodeHelpers.requireValue(_value);

        this._value = _value;
    } 

This also happens when the effective range covers the entire type.

The problem seems to be that BindingGeneratorUtil (i.e. mdsal-binding-generator) does not filter implied ranges, but rather we filter them in RangeGenerator (i.e. mdsal-binding-java-api-generator) – at which point we do not have an easy way to suppress these.

It would seem we should be able to filter the expressions before we emit Restrictions, and thus make it easy to skip the checks.


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