Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-14

Built-in type should return null for getBaseType()

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: Windows
      Platform: PC

    • 70

    Description

      When calling getBaseType() on a built in type, it should return null.
      Currently it seems to be returning itself.

      This would allow code like that below to work.

      public static TypeDefinition getRootType(final TypeDefinition typeDef) {
      assert typeDef != null;

      TypeDefinition t = typeDef;

      while (t.getBaseType() != null)

      { t = t.getBaseType(); }
      return t;
      }

      currently I need to do :

      public static TypeDefinition getRootType(final TypeDefinition typeDef) {
      assert typeDef != null;

      TypeDefinition t = typeDef;

      while ((t.getBaseType() != null) && (!t.getQName().getLocalName().equals(t.getBaseType().getQName().getLocalName()))) { t = t.getBaseType(); }

      return t;
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            chrhartl@cisco.com Christopher Hartley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: