[MDSAL-348] enumerated type with enum value 'optional' is not compilable Created: 07/Jun/18  Updated: 08/Jun/18  Resolved: 08/Jun/18

Status: Resolved
Project: mdsal
Component/s: Binding codegen
Affects Version/s: Fluorine
Fix Version/s: Fluorine

Type: Bug Priority: Medium
Reporter: Richard Kosegi Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Source are generated using yang-maven-plugin:2.0.5:generate-sources MOJO using default configuration inherited from

    <parent>
        <groupId>org.opendaylight.mdsal</groupId>
        <artifactId>binding-parent</artifactId>
        <version>0.13.0-SNAPSHOT</version>
        <relativePath />
    </parent>

 



 Description   

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.

 



 Comments   
Comment by Robert Varga [ 07/Jun/18 ]

Missing version...

Comment by Richard Kosegi [ 07/Jun/18 ]

My bad, updated environment info

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