[YANGTOOLS-335] Potentional bug: AbstractGeneratedTypeBuilder allows multiple addition of elements witch equals Created: 10/Oct/14 Updated: 10/Apr/22 Resolved: 20/Oct/14 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Peter Kajsa | Assignee: | Peter Kajsa |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 2172 |
| Description |
|
Potentional bug: AbstractGeneratedTypeBuilder allows multiple addition (via add* methods) of elements witch equals. Check of duplicity of added elements is missing in add* methods of AbstractGeneratedTypeBuilder and subclass GeneratedTypeBuilderImpl. For an example, it is possible to add two constants with the same type, name and value: GeneratedTypeBuilder generatedTypeBuilder = new GeneratedTypeBuilderImpl("my.package","MyName"); Constant constant1 = generatedTypeBuilder.addConstant(Types.typeForClass(String.class), "myConstant", "myConstantValue"); Constant constant2 = generatedTypeBuilder.addConstant(Types.typeForClass(String.class), "myConstant", "myConstantValue"); constant2 != null //true, constant2 is not null generatedTypeBuilder.toInstance().getConstantDefinitions().size() //2 The same behavior is present also in other add* methods. Notice: Maybe this is not a bug and the check is performed somewhere else just before generation of source code from these objects. |
| Comments |
| Comment by Peter Kajsa [ 17/Oct/14 ] |