Fix JDK11 deprecations 59/79259/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 7 Jan 2019 00:00:48 +0000 (01:00 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 7 Jan 2019 00:04:32 +0000 (01:04 +0100)
Explicit integral constructors have been deprecated, as was
Class.newInstance(). Adjust to that.

Change-Id: Ia78e6a0347c2b0264afc722f00acc716899e661f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronObject.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronFirewallJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronQosJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronSFCFlowClassifierJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronSecurityRuleJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronVpnDeadPeerDetectionJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronVpnIkePolicyJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronVpnIpSecPolicyJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronVpnIpSecSiteConnectionJAXBTest.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronVpnLifetimeJAXBTest.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/AbstractTranscriberInterface.java

index d2fc06cc2038fb7513e88b18abe89ae1250cbe25..255ff47b1af470c7ab3a1ed3ce69bc59a8e4109f 100644 (file)
@@ -116,8 +116,8 @@ public abstract class NeutronObject<T extends NeutronObject<T>> extends NeutronI
         Class<T> cls = (Class<T>) types[NEUTRON_OBJECT_CLASS_TYPE_INDEX];
         T ans;
         try {
-            ans = cls.newInstance();
-        } catch (IllegalAccessException | InstantiationException e) {
+            ans = cls.getDeclaredConstructor().newInstance();
+        } catch (ReflectiveOperationException e) {
             // should not happen.
             throw new IllegalStateException(e);
         }
index f42fbadd17983f5d129acce6b3f8301ab3380c7b..8b3e43595537848994ba99fe9d40df8c65f23839 100644 (file)
@@ -94,7 +94,7 @@ public class NeutronFirewallJAXBTest {
         Assert.assertEquals("NeutronFirewallRule JAXB Test 7: Testing protocol failed", "tcp",
                 testObject.getFirewallRuleProtocol());
 
-        Assert.assertEquals("NeutronFirewallRule JAXB Test 8: Testing IP version failed", new Integer(4),
+        Assert.assertEquals("NeutronFirewallRule JAXB Test 8: Testing IP version failed", Integer.valueOf(4),
                 testObject.getFirewallRuleIpVer());
 
         Assert.assertEquals("NeutronFirewallRule JAXB Test 9: Testing source IP address failed", "10.10.10.8",
@@ -110,12 +110,12 @@ public class NeutronFirewallJAXBTest {
                 testObject.getFirewallRuleSrcPortRangeMax());
 
         Assert.assertEquals("NeutronFirewallRule JAXB Test 12.1: Testing destination port min failed",
-                new Integer(80), testObject.getFirewallRuleDstPortRangeMin());
+                Integer.valueOf(80), testObject.getFirewallRuleDstPortRangeMin());
 
         Assert.assertEquals("NeutronFirewallRule JAXB Test 12.2: Testing destination port max failed",
-                new Integer(81), testObject.getFirewallRuleDstPortRangeMax());
+                Integer.valueOf(81), testObject.getFirewallRuleDstPortRangeMax());
 
-        Assert.assertEquals("NeutronFirewallRule JAXB Test 13: Testing position failed", new Integer(1),
+        Assert.assertEquals("NeutronFirewallRule JAXB Test 13: Testing position failed", Integer.valueOf(1),
                 testObject.getFirewallRulePosition());
 
         Assert.assertEquals("NeutronFirewallRule JAXB Test 14: Testing action", "allow",
index 429b1c489132fb08634e51f65490b4f524dced17..c9c4cec633a13c832ed40b9fb43949c09223a3d2 100644 (file)
@@ -73,7 +73,7 @@ public class NeutronQosJAXBTest {
                 "aa902936679e4ea29bfe1158e3450a14", dscpMarkingPolicyRules.get(0).getTenantID());
 
         Assert.assertEquals("NeutronQosPolicy JaxB Test 6.3 : Testing Max ingress/Egress value failed",
-            new Short("8"), dscpMarkingPolicyRules.get(0).dscpMark);
+            Short.valueOf((short)8), dscpMarkingPolicyRules.get(0).dscpMark);
 
         List<NeutronQosMinimumBandwidthRule> minBandwidthLimitRules = neutronObject.getMinimumBandwidthRules();
 
index 3bb5818ce400ada9fd7a4ea15fe0957c68c64b9a..a8448cbc3a97662f24f0a4474a2c1f9d6d295e93 100644 (file)
@@ -42,16 +42,16 @@ public class NeutronSFCFlowClassifierJAXBTest {
                 neutronObject.getProtocol());
 
         Assert.assertEquals("NeutronSFCFlowClassifier JAXB Test 5: Testing source_port_range_min failed",
-                new Integer(100), neutronObject.getSourcePortRangeMin());
+                Integer.valueOf(100), neutronObject.getSourcePortRangeMin());
 
         Assert.assertEquals("NeutronSFCFlowClassifier JAXB Test 6: Testing source_port_range_max failed",
-                new Integer(200), neutronObject.getSourcePortRangeMax());
+                Integer.valueOf(200), neutronObject.getSourcePortRangeMax());
 
         Assert.assertEquals("NeutronSFCFlowClassifier JAXB Test 7: Testing destination_port_range_min failed",
-                new Integer(100), neutronObject.getDestinationPortRangeMin());
+                Integer.valueOf(100), neutronObject.getDestinationPortRangeMin());
 
         Assert.assertEquals("NeutronSFCFlowClassifier JAXB Test 8: Testing destination_port_range_max failed",
-                new Integer(200), neutronObject.getDestinationPortRangeMax());
+                Integer.valueOf(200), neutronObject.getDestinationPortRangeMax());
 
         Assert.assertEquals("NeutronSFCFlowClassifier JAXB Test 9: Testing source_ip_prefix failed", "10.0.0.0/24",
                 neutronObject.getSourceIpPrefix());
index 06b47c35748445a7fcea510e305d742d91867f36..d2e8bc54c214d9b9a47f050f205f464fe24ac232 100644 (file)
@@ -51,10 +51,10 @@ public class NeutronSecurityRuleJAXBTest {
         Assert.assertEquals("NeutronSecurityRule JAXB Test 3: Testing protocol failed", "tcp",
                 testObject.getSecurityRuleProtocol());
 
-        Assert.assertEquals("NeutronSecurityRule JAXB Test 4: Testing port range min failed", new Integer(80),
+        Assert.assertEquals("NeutronSecurityRule JAXB Test 4: Testing port range min failed", Integer.valueOf(80),
                 testObject.getSecurityRulePortMin());
 
-        Assert.assertEquals("NeutronSecurityRule JAXB Test 5: Testing port range max failed", new Integer(80),
+        Assert.assertEquals("NeutronSecurityRule JAXB Test 5: Testing port range max failed", Integer.valueOf(80),
                 testObject.getSecurityRulePortMax());
 
         Assert.assertEquals("NeutronSecurityRule JAXB Test 6: Testing ethertype failed", "IPv4",
index e8b236a2873704339fae2e1048ace3ead39da763..70fe369c756022fd7853637af63585ae65e84bcf 100644 (file)
@@ -24,10 +24,10 @@ public class NeutronVpnDeadPeerDetectionJAXBTest {
         Assert.assertEquals("NeutronVpnDeadPeerDetection JAXB Test 1: Testing action failed", "hold",
                 testObject.getAction());
 
-        Assert.assertEquals("NeutronVpnDeadPeerDetection JAXB Test 2: Testing interval failed", new Integer(30),
+        Assert.assertEquals("NeutronVpnDeadPeerDetection JAXB Test 2: Testing interval failed", Integer.valueOf(30),
                 testObject.getInterval());
 
-        Assert.assertEquals("NeutronVpnDeadPeerDetection JAXB Test 3: Testing timeout failed", new Integer(120),
+        Assert.assertEquals("NeutronVpnDeadPeerDetection JAXB Test 3: Testing timeout failed", Integer.valueOf(120),
                 testObject.getTimeout());
     }
 }
index 9b73cf3240faa90ad5e9c92db113c93242d44e4e..3fe56c626ecd721d949e71e3b9b7903f842fc4d3 100644 (file)
@@ -49,7 +49,7 @@ public class NeutronVpnIkePolicyJAXBTest {
         Assert.assertEquals("NeutronVpnIkePolicy JAXB Test 10.1: Testing lifetime units value failed", "seconds",
                 testObject.getLifetime().getUnits());
 
-        Assert.assertEquals("NeutronVpnIkePolicy JAXB Test 10.2: Testing lifetime values failed", new Integer(3600),
+        Assert.assertEquals("NeutronVpnIkePolicy JAXB Test 10.2: Testing lifetime values failed", Integer.valueOf(3600),
                 testObject.getLifetime().getValue());
 
         Assert.assertEquals("NeutronVpnIkePolicy JAXB Test 2: Testing tenant id failed",
index 1d9bf6081f53d91876c993050b5be0b3b002c360..d23697665fcbf0e380f057809f559c8d3487757c 100644 (file)
@@ -50,7 +50,7 @@ public class NeutronVpnIpSecPolicyJAXBTest {
         Assert.assertEquals("NeutronVpnIpSecPolicy JAXB Test 10: Testing Lifetime unit value failed", "seconds",
                 testObject.getLifetime().getUnits());
 
-        Assert.assertEquals("NeutronVpnIpSecPolicy JAXB Test 11: Testing Lifetime value failed", new Integer(3600),
+        Assert.assertEquals("NeutronVpnIpSecPolicy JAXB Test 11: Testing Lifetime value failed", Integer.valueOf(3600),
                 testObject.getLifetime().getValue());
 
         Assert.assertEquals("NeutronVpnIpSecPolicy JAXB Test 2: Testing tenant id failed",
index c758d9efc7cd3661110aea5aa2ba0755450585bb..6dad5c10464164630b6320817ee32d2beed3902f 100644 (file)
@@ -85,10 +85,10 @@ public class NeutronVpnIpSecSiteConnectionJAXBTest {
                 "hold", testObject.getDeadPeerDetection().getAction());
 
         Assert.assertEquals("NeutronVpnIpSecSiteConnection JAXB Test 18.2: Testing DeadPeerDetection failed",
-                new Integer(30), testObject.getDeadPeerDetection().getInterval());
+                Integer.valueOf(30), testObject.getDeadPeerDetection().getInterval());
 
         Assert.assertEquals("NeutronVpnIpSecSiteConnection JAXB Test 18.3: Testing DeadPeerDetection failed",
-                new Integer(120), testObject.getDeadPeerDetection().getTimeout());
+                Integer.valueOf(120), testObject.getDeadPeerDetection().getTimeout());
 
         Assert.assertEquals("NeutronVpnIpSecSiteConnection JAXB Test 2: Testing tenant id failed",
                 "ccb81365fe36411a9011e90491fe1330", testObject.getTenantID());
index d16dcde2f7187dc67d8150b0680b85f65139a96b..ef56b655e257af14b907cb024f797e0c9d441e4b 100644 (file)
@@ -24,7 +24,7 @@ public class NeutronVpnLifetimeJAXBTest {
         Assert.assertEquals("NeutronVpnLifetime JAXB Test 1: Testing units failed", "seconds",
                 testObject.getUnits());
 
-        Assert.assertEquals("NeutronVpnLifetime JAXB Test 2: Testing value failed", new Integer(3600),
+        Assert.assertEquals("NeutronVpnLifetime JAXB Test 2: Testing value failed", Integer.valueOf(3600),
                 testObject.getValue());
     }
 }
index f3f53b3a313dae80db085263ad8664634e28abf8..04dbd4cc781eb7dd28892dff2030e93bf444231c 100644 (file)
@@ -189,7 +189,7 @@ public abstract class AbstractTranscriberInterface<
         B toMdIds(INeutronObject<S1> neutronObject, Class<B> builderClass) {
         B builder;
         try {
-            builder = builderClass.newInstance();
+            builder = builderClass.getDeclaredConstructor().newInstance();
 
             if (neutronObject.getID() != null) {
                 final Method setUuid = builderClass.getMethod("setUuid", Uuid.class);
@@ -207,8 +207,7 @@ public abstract class AbstractTranscriberInterface<
                 final Method setRevisionNumber = builderClass.getMethod("setRevisionNumber", Long.class);
                 setRevisionNumber.invoke(builder, neutronObject.getRevisionNumber());
             }
-        } catch (IllegalAccessException | InstantiationException | InvocationTargetException
-                | NoSuchMethodException e) {
+        } catch (ReflectiveOperationException e) {
             throw new IllegalArgumentException(e);
         }
         return builder;
@@ -303,9 +302,9 @@ public abstract class AbstractTranscriberInterface<
     protected T toMd(String uuid) {
         Builder<T> builder;
         try {
-            builder = builderClass.newInstance();
+            builder = builderClass.getDeclaredConstructor().newInstance();
             setUuid.invoke(builder, toUuid(uuid));
-        } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+        } catch (ReflectiveOperationException e) {
             // should not happen.
             throw new IllegalArgumentException(e);
         }