[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:
Blocks
is blocked by OPNFLWPLUG-1019 openflowplugin-extension-nicira-match... Resolved
Relates
relates to MDSAL-332 Class name conflict if identity and g... Resolved
relates to TSC-127 Failure to respond to issue blocking ... Closed

 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.

Generated at Wed Feb 07 20:09:35 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.