[MDSAL-58] Binding Java API Generator: Inner class with same name as outer class is not allowed Created: 12/Nov/14  Updated: 09/Mar/18  Resolved: 01/Mar/18

Status: Verified
Project: mdsal
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Martin Ciglan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
is blocked by MDSAL-237 Milestone: Implement Binding Specific... Resolved
External issue ID: 2360

 Description   

If model contains this structure:

.
.
.
case group {
leaf group {
type union {
.
.
.

binding generator generates Group interface with inner Group class, which is not compilable.
It's supposed to be fixed within binding specification version 2



 Comments   
Comment by Shivani Pathak [ 20/Nov/15 ]

As this problem persists specifically when [case and leaf name is same] & [leaf Type is 'Union'],one option is to add some prefix with the name of the inner class(corresponding to the leaf) while converting Yang into Java code so that there will not be any conflict between outer class and inner class name.

Below is an example for the same:

Ex.Container mycont{
choice Choice{
case myCase{
leaf myCase{
type Union

{ type int32; type string; }

}
}
}
}

An interface will be created for case 'MyCase.java' with an inner class named 'MyCase'.

We can add a check to append a prefix to the inner class such as InnerMyCase.

Please suggest and provide any references/documents if any to help me in making the changes in specific generators as this scenario is very particular and the suggested chnage will have a generic impact on so many scenarios.

Comment by Martin Ciglan [ 11/Mar/16 ]

solution of this issue is part of new Binding specification v2, which is going to be designed and implemented in Boron

Comment by Vratko Polak [ 06/Jul/16 ]

More example structures:
...
container foo {
leaf foo {
type union {
...
list bar {
leaf bar {
type union {
...

Comment by Vratko Polak [ 06/Jul/16 ]

A complete yang model for testing:
https://git.opendaylight.org/gerrit/41392

Comment by Jie Han [ 20/Oct/17 ]

This issue has been resolved in binding2.

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