[MDSAL-350] Binding codegen should not tolerate duplicate files Created: 18/Jun/18 Updated: 15/Jan/24 |
|
| Status: | Confirmed |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
Duplicate classes are indicative of a mapping conflict and we should not merely warn on them, but rather fail the build unless instructed otherwise. Refactor org.opendaylight.mdsal.binding.java.api.generator.GeneratorJavaFile and org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl to perform two-stage file/codegen mapping so that they lazily map files/content. GeneratorJavaFile.generateToFile() needs to be updated to return Map<File, CharSource>, which will contain unique mapping. It should take a flag indicating whether conflicts should cause an abort or should be ignored. CodeGeneratorImpl needs to then perform the actual generation output and route maven configuration to that flag. |
| Comments |
| Comment by Robert Varga [ 18/Jun/21 ] |
|
This still requires dealing with Builder naming, as we have a test which explodes on this, i.e. we have: module class-name-collision { yang-version 1; namespace "urn:class:name:collision"; prefix "bar"; list string { } list string-builder { } } i.e. we explode on StringBuilder being claimed by two entities. |