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

enumerated type with enum value 'optional' is not compilable

XMLWordPrintable

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

      This snippet is not compilable:

       

       

      typedef tls-client-verify {
          type enumeration {
              enum require {
              }
              enum optional {
              }
              enum none {
              }
          }
      }

       

      With error

       

      [ERROR] some/path/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/jsonrpc/authsec/rev180607/TlsClientVerify.java:[74,24] cannot find symbol
      [ERROR]   symbol:   method ofNullable(org.opendaylight.yang.gen.v1.urn.opendaylight.jsonrpc.authsec.rev180607.TlsClientVerify)
      [ERROR]   location: variable Optional of type org.opendaylight.yang.gen.v1.urn.opendaylight.jsonrpc.authsec.rev180607.TlsClientVerify

      Because of generated code:

       

      Required(0, "required"),
      Optional(1, "optional"),
      None(2, "none")
      ;

       

       

      public static Optional<TlsClientVerify> forName(String name) {
          return Optional.ofNullable(NAME_MAP.get(Objects.requireNonNull(name)));
      }

       

      Optional is referring to both enum value and java.util.Optional class.

       

            rovarga Robert Varga
            rkosegi Richard Kosegi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: