Disambiguate generated nested enumerations 99/69599/11
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 19 Mar 2018 01:11:45 +0000 (02:11 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Mar 2018 08:47:45 +0000 (09:47 +0100)
commitacb4d4f5909022a36b80169c84d2f3728f53cc57
treefae670823d21d3b7c203d0e5ad90170ec9baef0e
parent12b9a4a5099fea3f3dcc58370271311c015b3d7b
Disambiguate generated nested enumerations

In case we have an enumeration defined directly in a leaf of the same
name as its containing generated type (list, container, etc.), we can
end up violating JLS section 8.1 class naming requirements.

Detect this condition and munge the type name by appending a '$' to
prevent this conflict.

Change-Id: Ia68cac2a96ac0a95fa38a83cb1cdc1c09540533b
JIRA: MDSAL-321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/AbstractTypeGenerator.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java
binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/generated/type/builder/AbstractGeneratedTypeBuilder.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/CompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/mdsal321/odl-mdsal321.yang [new file with mode: 0644]