Remove getter @Nullable annotations for non-List/Map types
authorIaroslav <iaroslav.kholiavko@pantheon.tech>
Fri, 4 Dec 2020 10:36:44 +0000 (12:36 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:34 +0000 (10:41 +1000)
In generated types getter will no longer be marked @Nullable annotation
for non List and Map types.

Jira: MDSAL-603
Change-Id: I2ad00e625f652399e184fca1a7a00d3ed36d3dff
Signed-off-by: Iaroslav <iaroslav.kholiavko@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/InterfaceTemplate.xtend

index 903b99fdd251f1c6de74a5b67fc320a3422894d2..799a0f85f5420c60ac55c38fcb6e55981f7afbfe 100644 (file)
@@ -338,7 +338,7 @@ class InterfaceTemplate extends BaseTemplate {
     '''
 
     def private String nullableType(Type type) {
-        if (type.isObject) {
+        if (type.isObject && (Types.isMapType(type) || Types.isListType(type))) {
             return type.importedNullable
         }
         return type.importedName