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

Subclassed type wrappers fail to check restrictions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Fluorine
    • None
    • Binding codegen
    • None

      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.

       

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

              Created:
              Updated:
              Resolved: