Properly annotate byte[] 69/97669/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Sep 2021 14:54:47 +0000 (16:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Sep 2021 14:56:41 +0000 (16:56 +0200)
This is the only case where we are using a simple array, which has
different annotation placement than reference types. Recognize it and do
the right thing.

JIRA: MDSAL-678
Change-Id: I38fe9c66cbfcf4388cc74ade241b4e986d2c7d6f
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/AbstractJavaGeneratedType.java

index cdbcc1654d6cf7432e052608fc63190b982cb3b0..63ecbd0dd1a809f2e870bdb9a30586fed5e14906 100644 (file)
@@ -81,9 +81,11 @@ abstract class AbstractJavaGeneratedType {
     }
 
     private String annotateReference(final String ref, final Type type, final String annotation) {
-        return type instanceof ParameterizedType ? getReferenceString(annotate(ref, annotation), type,
-                ((ParameterizedType) type).getActualTypeArguments())
-                : annotate(ref, annotation).toString();
+        if (type instanceof ParameterizedType) {
+            return getReferenceString(annotate(ref, annotation), type,
+                ((ParameterizedType) type).getActualTypeArguments());
+        }
+        return "byte[]".equals(ref) ? "byte @" + annotation + "[]" : annotate(ref, annotation).toString();
     }
 
     final String getFullyQualifiedReference(final Type type, final String annotation) {