[YANGTOOLS-401] Restricted leaf's union type - Java API generator fails with IllegalArgumentException Created: 22/Jan/15  Updated: 10/Apr/22  Resolved: 23/Jan/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Milos Fabian Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Issue Links:
Duplicate
duplicates MDSAL-51 Binding Java API Generator -> NPE dur... Resolved
External issue ID: 2619

 Description   

module union-restrictions {
yang-version 1;
namespace "urn:yang.foo";
prefix "foo";

import ietf-inet-types

{ prefix inet; }

container foo {
leaf address {
type inet:host

{ //blah,blah,blah }

}
}
}

Binding Java API generator fails with "strange" (not relevant from user's point of view) error:

java.lang.IllegalArgumentException: Type cannot have Package Name referenced as NULL!
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:92)
at org.opendaylight.yangtools.sal.java.api.generator.GeneratorUtil.putTypeIntoImports(GeneratorUtil.java:138)
at org.opendaylight.yangtools.sal.java.api.generator.BaseTemplate.importedName(BaseTemplate.java:244)
at org.opendaylight.yangtools.sal.java.api.generator.InterfaceTemplate.generateMethods(InterfaceTemplate.java:369)
at org.opendaylight.yangtools.sal.java.api.generator.InterfaceTemplate.body(InterfaceTemplate.java:113)
at org.opendaylight.yangtools.sal.java.api.generator.BaseTemplate.generate(BaseTemplate.java:77)


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