add -Xlint:unchecked and -Xlint:deprecation to compiler argument 79/41379/1
authorIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 6 Jul 2016 06:02:47 +0000 (23:02 -0700)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Wed, 6 Jul 2016 06:25:05 +0000 (23:25 -0700)
This patch adds compiler option -Xlint:unchecked and -Xlint:deprecation
and remove their warnings.

Change-Id: I3f1c4b8411da480cfb86671819cb88f78ae32ccf
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
model/pom.xml
neutron-logger/pom.xml
neutron-logger/src/main/java/org/opendaylight/neutron/logger/NeutronLogger.java
neutron-spi/pom.xml
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet_HostRoute.java [deleted file]
northbound-api/pom.xml
parent/pom.xml
transcriber/pom.xml
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronSubnetInterface.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronTranscriberProvider.java

index 82e727867bbd5fc2c9bccd93fbbaf42b950b72e2..29657a0328183e29f874de4a6364cd0a691dd54d 100644 (file)
@@ -74,6 +74,17 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <scm>
index a5e4b7cdd0c61e498ad9463776efe239b06cb89c..35a45967ec0603c93e9984e3d0001b0d121ae2f4 100644 (file)
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <scm>
index 95de39f4e0ea5cf5a6da8ac2c0584cae95ff7139..b9d15db7d1613808abb5bcb11db355c8dcb4aa89 100644 (file)
@@ -29,10 +29,10 @@ public class NeutronLogger implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(NeutronLogger.class);
 
     private DataBroker db;
-    private ClusteredDataTreeChangeListener configurationDataTreeChangeListener;
-    private ListenerRegistration<? extends ClusteredDataTreeChangeListener> configurationRegisteredListener;
-    private ClusteredDataTreeChangeListener operationalDataTreeChangeListener;
-    private ListenerRegistration<? extends ClusteredDataTreeChangeListener> operationalRegisteredListener;
+    private ClusteredDataTreeChangeListener<Neutron> configurationDataTreeChangeListener;
+    private ListenerRegistration<? extends ClusteredDataTreeChangeListener<Neutron>> configurationRegisteredListener;
+    private ClusteredDataTreeChangeListener<Neutron> operationalDataTreeChangeListener;
+    private ListenerRegistration<? extends ClusteredDataTreeChangeListener<Neutron>> operationalRegisteredListener;
 
     public NeutronLogger(@Nonnull DataBroker db) {
         LOG.info("Creating NeutronLogger {}", db);
@@ -70,7 +70,7 @@ public class NeutronLogger implements AutoCloseable {
     private <T extends DataObject>
         void formatChanges(@Nonnull final StringBuilder messageBuilder,
                            @Nonnull final Collection<DataTreeModification<T>> changes) {
-        for (DataTreeModification modification : changes) {
+        for (DataTreeModification<T> modification : changes) {
             final DataTreeIdentifier<T> identifier = modification.getRootPath();
             final LogicalDatastoreType datastoreType = identifier.getDatastoreType();
             if (datastoreType == LogicalDatastoreType.OPERATIONAL) {
index f8f41a47e1645ef794a10ec2724a44870fe57f59..65dc890cfea1ba6f733a5f950d422c0a3d076d74 100644 (file)
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <scm>
index fac4b747330c378b4e8f1d8266792d056400dac5..e82166cc37615ebb3fdf0537588019d69ea29455 100644 (file)
@@ -68,7 +68,7 @@ public class NeutronSubnet extends NeutronObject implements Serializable, INeutr
     List<NeutronSubnetIPAllocationPool> allocationPools;
 
     @XmlElement (name = "host_routes")
-    List<NeutronSubnet_HostRoute> hostRoutes;
+    List<NeutronRoute> hostRoutes;
 
     @XmlElement (defaultValue = "true", name = "enable_dhcp")
     Boolean enableDHCP;
@@ -135,11 +135,11 @@ public class NeutronSubnet extends NeutronObject implements Serializable, INeutr
         this.allocationPools = allocationPools;
     }
 
-    public List<NeutronSubnet_HostRoute> getHostRoutes() {
+    public List<NeutronRoute> getHostRoutes() {
         return hostRoutes;
     }
 
-    public void setHostRoutes(List<NeutronSubnet_HostRoute> hostRoutes) {
+    public void setHostRoutes(List<NeutronRoute> hostRoutes) {
         this.hostRoutes = hostRoutes;
     }
 
@@ -208,7 +208,7 @@ public class NeutronSubnet extends NeutronObject implements Serializable, INeutr
                 ans.setAllocationPools(aPools);
             }
             if (s.equals("host_routes")) {
-                List<NeutronSubnet_HostRoute> hRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+                List<NeutronRoute> hRoutes = new ArrayList<NeutronRoute>();
                 hRoutes.addAll(this.getHostRoutes());
                 ans.setHostRoutes(hRoutes);
             }
@@ -306,7 +306,7 @@ public class NeutronSubnet extends NeutronObject implements Serializable, INeutr
             dnsNameservers = new ArrayList<String>();
         }
         if (hostRoutes == null) {
-            hostRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+            hostRoutes = new ArrayList<NeutronRoute>();
         }
         if (allocationPools == null) {
             allocationPools = new ArrayList<NeutronSubnetIPAllocationPool>();
diff --git a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet_HostRoute.java b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronSubnet_HostRoute.java
deleted file mode 100644 (file)
index 73a812e..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2013, 2015 IBM Corporation and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.neutron.spi;
-
-import java.io.Serializable;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.NONE)
-@Deprecated
-public class NeutronSubnet_HostRoute implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    // See OpenStack Network API v2.0 Reference for description of
-    // annotated attributes
-
-    @XmlElement(name = "destination")
-    String destination;
-
-    @XmlElement(name = "nexthop")
-    String nextHop;
-
-    /**
-     *  HostRoute constructor
-     */
-    public NeutronSubnet_HostRoute() { }
-
-    public String getDestination() {
-        return destination;
-    }
-
-    public void setDestination(String destination) {
-        this.destination = destination;
-    }
-
-    public String getNextHop() {
-        return nextHop;
-    }
-
-    public void setNextHop(String nextHop) {
-        this.nextHop = nextHop;
-    }
-
-    @Override
-    public String toString() {
-        return "NeutronSubnetHostRoute [" +
-            "destination=" + destination +
-            ", nextHop=" + nextHop + "]";
-    }
-
-}
index b5e7d69e4d29a6288d235c12aaeac6de25918734..f8a9912e9d29e7ff3f76ac2d11a85ea446d246a4 100644 (file)
           <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <scm>
index 55f7a1cf2d1b4cee1c791c64a6f74a5ff647c180..6d545cef046cbc1399fad98be4f1116d810c3a5e 100644 (file)
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
       </plugin>
       <plugin>
         <artifactId>maven-source-plugin</artifactId>
index 3d7156e11d6110a6b1217a9a263a6eb85ab9c181..b180a872cf4bfa1ce4f3f90d123723244dec58bd 100644 (file)
           <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <compilerArgs>
+            <arg>-Xlint:unchecked</arg>
+            <arg>-Xlint:deprecation</arg>
+          </compilerArgs>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
index 8cf824983a7ae9e356d15a21e1607c42793890b4..2f3cd7e77117e200feea444abaf15c64db82410d 100644 (file)
@@ -12,8 +12,8 @@ import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
+import org.opendaylight.neutron.spi.NeutronRoute;
 import org.opendaylight.neutron.spi.NeutronSubnet;
-import org.opendaylight.neutron.spi.NeutronSubnet_HostRoute;
 import org.opendaylight.neutron.spi.NeutronSubnetIPAllocationPool;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
@@ -106,9 +106,9 @@ public class NeutronSubnetInterface extends AbstractNeutronInterface<Subnet, Sub
             result.setDnsNameservers(dnsNameServers);
         }
         if(subnet.getHostRoutes() != null){
-            final List<NeutronSubnet_HostRoute> hostRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+            final List<NeutronRoute> hostRoutes = new ArrayList<NeutronRoute>();
             for(final HostRoutes hostRoute : subnet.getHostRoutes()) {
-                final NeutronSubnet_HostRoute nsHostRoute = new NeutronSubnet_HostRoute();
+                final NeutronRoute nsHostRoute = new NeutronRoute();
                 nsHostRoute.setDestination(String.valueOf(hostRoute.getDestination().getValue()));
                 nsHostRoute.setNextHop(String.valueOf(hostRoute.getNexthop().getValue()));
                 hostRoutes.add(nsHostRoute);
@@ -178,7 +178,7 @@ public class NeutronSubnetInterface extends AbstractNeutronInterface<Subnet, Sub
         }
         if(subnet.getHostRoutes() != null) {
             final List<HostRoutes> hostRoutes = new ArrayList<HostRoutes>();
-            for(final NeutronSubnet_HostRoute hostRoute: subnet.getHostRoutes()) {
+            for(final NeutronRoute hostRoute: subnet.getHostRoutes()) {
                 final HostRoutesBuilder hrBuilder = new HostRoutesBuilder();
                 hrBuilder.setDestination(new IpPrefix(hostRoute.getDestination().toCharArray()));
                 hrBuilder.setNexthop(new IpAddress(hostRoute.getNextHop().toCharArray()));
index 339719f4c0334f41112b2b8aae1f6dff778b50ed..3ce44be3b76921ab2f44ff4731da97befad246aa 100644 (file)
@@ -92,8 +92,10 @@ public class NeutronTranscriberProvider
     private <S extends INeutronCRUD<?>, T extends AutoCloseable /* & S */>
     void registerCRUDInterface(java.lang.Class<S> clazz, T crudInterface) {
         neutronInterfaces.add(crudInterface);
+        @SuppressWarnings("unchecked")
+        S sCrudInterface = (S)crudInterface;
         final ServiceRegistration<S> crudInterfaceRegistration =
-            context.registerService(clazz, (S)crudInterface, null);
+                context.registerService(clazz, sCrudInterface, null);
         registrations.add(crudInterfaceRegistration);
     }