BUG-4638: fix typedefToGeneratedType() 25/30025/8
authorRobert Varga <rovarga@cisco.com>
Fri, 20 Nov 2015 22:54:41 +0000 (23:54 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 30 Nov 2015 16:13:15 +0000 (16:13 +0000)
New parser does not generated ExtendedTypes. Since the callsite is all
about type definitions, it is safe to change that check to a check if
the provided type definitions has a base type.

Change-Id: I39d67b7d4d431c1cc8b212cc81597d667b20a734
Signed-off-by: Robert Varga <rovarga@cisco.com>
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java

index 55693323fd78c7fc69ed03e5b9a10dc92a5145f3..d568c947dd34a9893b7639c723f6607c3e47c21f 100644 (file)
@@ -736,9 +736,8 @@ public final class TypeProviderImpl implements TypeProvider {
             if (!(innerTypeDefinition instanceof LeafrefTypeDefinition)
                     && !(innerTypeDefinition instanceof IdentityrefTypeDefinition)) {
                 Type returnType = null;
-                if (innerTypeDefinition instanceof ExtendedType) {
-                    ExtendedType innerExtendedType = (ExtendedType) innerTypeDefinition;
-                    returnType = provideGeneratedTOFromExtendedType(typedef, innerExtendedType, basePackageName,
+                if (innerTypeDefinition.getBaseType() != null) {
+                    returnType = provideGeneratedTOFromExtendedType(typedef, innerTypeDefinition, basePackageName,
                             module.getName());
                 } else if (innerTypeDefinition instanceof UnionTypeDefinition) {
                     final GeneratedTOBuilder genTOBuilder = provideGeneratedTOBuilderForUnionTypeDef(basePackageName,
@@ -1272,7 +1271,7 @@ public final class TypeProviderImpl implements TypeProvider {
      *             </ul>
      */
     private GeneratedTransferObject provideGeneratedTOFromExtendedType(final TypeDefinition<?> typedef,
-            final ExtendedType innerExtendedType, final String basePackageName, final String moduleName) {
+            final TypeDefinition<?> innerExtendedType, final String basePackageName, final String moduleName) {
         Preconditions.checkArgument(innerExtendedType != null, "Extended type cannot be NULL!");
         Preconditions.checkArgument(basePackageName != null, "String with base package name cannot be NULL!");