Add @Nullable annotations on getters 99/69399/13
authorStephen Kitt <skitt@redhat.com>
Mon, 12 Mar 2018 18:19:33 +0000 (19:19 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 22 May 2018 23:35:21 +0000 (01:35 +0200)
commitd08575a3a4d04e190b31c182e280d9040e560a2d
tree46caa7a26560aa5072207c346f1bff6ffa76352b
parent7b7b30694cb5897681310673a69e2a287fafbd8e
Add @Nullable annotations on getters

Generated getters’ documentation states that they can return null if
no value is present; this patch adds a @Nullable annotation to
accompany the comment, allowing null-pointer analysis on generated
bindings.

This would help avoid various NPEs we’ve seen in practice in Genius
and NetVirt.

Change-Id: I8c8cfa9ae24d34f3a7140623065dfb377f5f2a13
Signed-off-by: Stephen Kitt <skitt@redhat.com>
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-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/CompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/CompilationTestUtils.java