[MDSAL-425] yang to java generation failed when list name is "e" Created: 15/Mar/19  Updated: 19/Mar/19  Resolved: 19/Mar/19

Status: Resolved
Project: mdsal
Component/s: None
Affects Version/s: Fluorine SR2
Fix Version/s: 4.0.0, Fluorine SR3, 3.0.7

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


 Description   

Api module compilation was successful until Oxygen-SR4 with below yang module definition, and it is failing in Flourine-SR2*. If the highlighted list name is changed from “e” to anything else is working fine.*

Yes,  nobody follows such a naming convention, it is just a sample program.

 

Please ignore if it is resolved already

 

Compilation errors :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project o4-sample-api: Compilation failure: Compilation failure:

[ERROR] /root/ODL/o4-sample/api/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/o4/sample/rev170830/a/b/d/EBuilder.java:[63,36] incompatible types: org.opendaylight.yangtools.yang.binding.Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.o4.sample.rev170830.a.b.d.E> cannot be converted to E

[ERROR] /root/ODL/o4-sample/api/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/o4/sample/rev170830/a/b/d/EBuilder.java:[101,26] org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.o4.sample.rev170830.a.b.d.EBuilder.EImpl is not abstract and does not override abstract method <E>augmentation(java.lang.Class<E>) in org.opendaylight.yangtools.yang.binding.Augmentable

[ERROR] /root/ODL/o4-sample/api/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/o4/sample/rev170830/a/b/d/EBuilder.java:[135,46] name clash: <E>augmentation(java.lang.Class<E>) in org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.o4.sample.rev170830.a.b.d.EBuilder.EImpl and <E>augmentation(java.lang.Class<E>) in org.opendaylight.yangtools.yang.binding.Augmentable have the same erasure, yet neither overrides the other

[ERROR] /root/ODL/o4-sample/api/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/o4/sample/rev170830/a/b/d/EBuilder.java:[134,9] method does not override or implement a method from a supertype

[ERROR] /root/ODL/o4-sample/api/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/o4/sample/rev170830/a/b/d/EBuilder.java:[136,40] incompatible types: org.opendaylight.yangtools.yang.binding.Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.o4.sample.rev170830.a.b.d.E> cannot be converted to E

[ERROR] -> [Help 1]

 

 

module o4-sample {

    yang-version 1;

    namespace "urn:opendaylight:params:xml:ns:yang:o4-sample";

    prefix "o4-sample";

 

    revision "2017-08-30"

{ // TODO change revision to date of model creation         description "Initial revision of o4-sample model";     }

   

    container a {

                   list b {

                      key b-key;

                      leaf b-key

{                         type string;                       }

                      leaf b-leaf

{                                type string;                       }

                      list c {

                               key c-key;

                               leaf c-key

{                                type string;                                }

                               leaf c-leaf

{                                                type string;                                }

                      }

                                  

                      list d {

                               key d-key;

                               leaf d-key

{                             type string;                                }

                            

                               list e {

                                   key e-key;

                                   leaf e-key{

                                               type string;

                                    }

                                }

                     }

                  }

   }

}



 Comments   
Comment by Robert Varga [ 16/Mar/19 ]

This boils down to Augmentable.augmentation() using <E> generic argument, which clashes with the class name.

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