Do not generate prime when not needed 18/110318/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Feb 2024 22:30:47 +0000 (23:30 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Feb 2024 22:37:08 +0000 (23:37 +0100)
commit37ba772acba4cf4f56e3814c073c64f096f94d02
tree65c9dc42c1ab0e1fdeb45e173a3621a23b6b1942
parent462592633aec85d51bcc280145b47055ec10743c
Do not generate prime when not needed

In case we do not have any properties we end up emitting a local
variable which we'll never use -- generating a compiler warning.

Improve InterfaceTemplate to check for this condition and emit the
prime only if there are actually at least one property.

Change-Id: I3341ca075e8c7c0b671a76f226b7bdb99cb12465
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/InterfaceTemplate.xtend
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderGeneratorTest.java