[MDSAL-797] Union's stringValue() does not handle BitsTypeObject Created: 05/Dec/22  Updated: 08/Dec/22  Resolved: 08/Dec/22

Status: Resolved
Project: mdsal
Component/s: Binding codegen
Affects Version/s: 11.0.0, 11.0.1, 11.0.2
Fix Version/s: 11.0.3

Type: Bug Priority: Highest
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MDSAL-743 Add BitsTypeObject Resolved

 Description   

Detected in downstream integration. For the following snippet:

  typedef access-operations-type {
    type bits {
      bit create {
      }
      bit read {
      }
      bit update {
      }
      bit delete {
      }
      bit exec {
      }
    }
  }

  leaf access-operations {
    type union {
      type matchall-string-type;
      type access-operations-type;
    }
    default *;
  } 

we end up generating this code:

        public String stringValue() {
            if (_matchallStringType != null) {
                return _matchallStringType.getValue().toString();
            }
            if (_accessOperationsType != null) {
                return Arrays.toString(_accessOperationsType.getValue());
            }
            throw new IllegalStateException("No value assigned");
        }

The reference in Arrays.toString() is wrong – it needs to call values(), as there is no getValue() method ever since we have BitsTypeObject.


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