Fixed bug in RPC and Generics mapping 82/582/2
authorTony Tkacik <ttkacik@cisco.com>
Wed, 10 Jul 2013 12:05:17 +0000 (14:05 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jul 2013 17:05:53 +0000 (17:05 +0000)
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/main/java/org/opendaylight/controller/sal/binding/generator/impl/BindingGeneratorImpl.java
opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorUtil.java

index 3f67b6704b4c4f8a99a383944b226c95fa9f15b3..bcaf3a062a754e4ea5303723a4159a3226c75bdb 100644 (file)
@@ -327,7 +327,8 @@ public final class BindingGeneratorImpl implements BindingGenerator {
             if (rpc != null) {
 
                 String rpcName = parseToClassName(rpc.getQName().getLocalName());
-                MethodSignatureBuilder method = interfaceBuilder.addMethod(rpcName);
+                String rpcMethodName = parseToValidParamName(rpcName);
+                MethodSignatureBuilder method = interfaceBuilder.addMethod(rpcMethodName);
 
                 final List<DataNodeIterator> rpcInOut = new ArrayList<>();
 
index a9f0557ecc0b38622c1b5c80c51634d841c19fba..dfae4a2ceaad57c3de7555e7867913416aa78535 100644 (file)
@@ -584,6 +584,9 @@ public final class GeneratorUtil {
                     builder.append(type.getName());
                 }
             }
+            if (type.equals(Types.voidType())) {
+                return "void";
+            }
             if (type instanceof ParameterizedType) {
                 final ParameterizedType pType = (ParameterizedType) type;
                 final Type[] pTypes = pType.getActualTypeArguments();
@@ -591,9 +594,6 @@ public final class GeneratorUtil {
                 builder.append(getParameters(pTypes, imports, currentPkg));
                 builder.append(">");
             }
-            if (builder.toString().equals("Void")) {
-                return "void";
-            }
             return builder.toString();
         }
     }
@@ -609,10 +609,17 @@ public final class GeneratorUtil {
             }
 
             String wildcardParam = "";
-            if (t instanceof WildcardType) {
-                wildcardParam = "? extends ";
+            if (t.equals(Types.voidType())) {
+                builder.append("java.lang.Void" + separator);
+                continue;
+            } else {
+
+                if (t instanceof WildcardType) {
+                    wildcardParam = "? extends ";
+                }
+
+                builder.append(wildcardParam + getExplicitType(t, availableImports, currentPkg) + separator);
             }
-            builder.append(wildcardParam + getExplicitType(t, availableImports, currentPkg) + separator);
         }
         return builder.toString();
     }