Use the diamond operator in generated Java 77/35977/2
authorStephen Kitt <skitt@redhat.com>
Wed, 9 Mar 2016 11:12:44 +0000 (12:12 +0100)
committerStephen Kitt <skitt@redhat.com>
Mon, 3 Oct 2016 11:59:24 +0000 (11:59 +0000)
Now that javaparser is used to verify the generated code, use <>.

Change-Id: I9ef5ad62108b91eba8565329386f96c777b03cdf
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/gofactory/AbsFactoryGeneratedObjectFactory.java

index 3ee43a6..e7a7d21 100644 (file)
@@ -129,11 +129,10 @@ public class AbsFactoryGeneratedObjectFactory {
                 "throw new UnsupportedOperationException(\"Class reloading is not supported\");\n"+
             "}\n", moduleFQN, DynamicMBeanWithInstance.class.getCanonicalName()));
 
-        // TODO The generic specifier in HashSet<> isn't necessary, but the Eclipse AST parser used in the unit tests doesn't support this
         b.addToBody(format("\n"+
             "@Override\n"+
             "public java.util.Set<%s> getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory dependencyResolverFactory, %s bundleContext) {\n"+
-                "return new java.util.HashSet<%1$s>();\n"+
+                "return new java.util.HashSet<>();\n"+
             "}\n", moduleFQN, BUNDLE_CONTEXT));
 
         return new GeneratedObjectBuilder(b.build()).toGeneratedObject();
@@ -177,8 +176,7 @@ public class AbsFactoryGeneratedObjectFactory {
 
         String result = "static {\n";
         if (!providedServices.isEmpty()) {
-            // TODO The generic specifier in HashSet<> isn't necessary, but the Eclipse AST parser used in the unit tests doesn't support this
-            result += format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<%1$s>();\n", generic);
+            result += format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<>();\n", generic);
 
             for(FullyQualifiedName fqn: providedServices) {
                 result += format("serviceIfcs2.add(%s.class);\n", fqn);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.