Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-351

Subclassed type wrappers fail to check restrictions

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • Fluorine
    • Binding codegen
    • None

    Description

      Given:

       

        typedef ipv4-address {
          type string {
            pattern
              '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
            +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
            + '(%[\p{N}\p{L}]+)?';
          }
        }
      
        typedef ipv4-address-no-zone {
          type inet:ipv4-address {
            pattern '[0-9\.]*';
          }
        }
      

      we end up with:

       

       

          @ConstructorProperties("value")
          public Ipv4AddressNoZone(String _value) {
              super(_value);
          
              Objects.requireNonNull(_value, "Supplied value may not be null");
              CodeHelpers.checkPattern(_value, patterns, regexes);
          
          }
          
          /**
           * Creates a copy from Source Object.
           *
           * @param source Source object
           */
          public Ipv4AddressNoZone(Ipv4AddressNoZone source) {
              super(source);
          }
          /**
           * Creates a new instance from Ipv4Address
           *
           * @param source Source object
           */
          public Ipv4AddressNoZone(Ipv4Address source) {
                  super(source);
          }
      
      

      note how the final constructor fails to perform additional checks required to comply with the argument. This needs to be rectified.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: