[YANGTOOLS-14] Built-in type should return null for getBaseType() Created: 12/Sep/13 Updated: 10/Apr/22 Resolved: 17/Sep/13 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Christopher Hartley | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Windows |
||
| External issue ID: | 70 |
| Description |
|
When calling getBaseType() on a built in type, it should return null. This would allow code like that below to work. public static TypeDefinition getRootType(final TypeDefinition typeDef) { 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; |
| Comments |
| Comment by Christopher Hartley [ 12/Sep/13 ] |
|
The javadocs should be updated too. Something like : If this is a derived type, then it returns the type that it is derived from. |
| Comment by Martin Vitez [ 17/Sep/13 ] |
|
Fixed in version 0.5.8-SNAPSHOT. |