Remove unnecessary casts 02/32102/2
authorGary Wu <gary.wu1@huawei.com>
Mon, 4 Jan 2016 19:48:18 +0000 (11:48 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 5 Jan 2016 12:44:45 +0000 (12:44 +0000)
Change-Id: Ib20f8d15529293ee9037c7213ed5eb388ba532ac
Signed-off-by: Gary Wu <gary.wu1@huawei.com>
opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BitBufferHelper.java
opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java
opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java

index fc515e109d1abebf95168f081ef289612648dda8..c1d2beff3e4ba84a6d0f2d4ddf730511e2483235 100644 (file)
@@ -103,7 +103,7 @@ public abstract class BitBufferHelper {
                 logger.error("", e);
             }
         }
                 logger.error("", e);
             }
         }
-        return (long) toNumber(data);
+        return toNumber(data);
     }
 
     /**
     }
 
     /**
@@ -189,7 +189,7 @@ public abstract class BitBufferHelper {
         } catch (BufferException e) {
             logger.error("", e);
         }
         } catch (BufferException e) {
             logger.error("", e);
         }
-        return (long) toNumber(bits, numBits);
+        return toNumber(bits, numBits);
     }
 
     /**
     }
 
     /**
@@ -238,7 +238,7 @@ public abstract class BitBufferHelper {
                 return bytes;
             } else {
                 System.arraycopy(data, startByteOffset, bytes, 0, numBytes - 1);
                 return bytes;
             } else {
                 System.arraycopy(data, startByteOffset, bytes, 0, numBytes - 1);
-                bytes[numBytes - 1] = (byte) ((int) data[startByteOffset
+                bytes[numBytes - 1] = (byte) (data[startByteOffset
                         + numBytes - 1] & getMSBMask(extranumBits));
             }
         } else {
                         + numBytes - 1] & getMSBMask(extranumBits));
             }
         } else {
@@ -363,7 +363,7 @@ public abstract class BitBufferHelper {
                 value += 256;
             }
             ret = ret
                 value += 256;
             }
             ret = ret
-                    | (long) ((long) value << ((length - i - 1) * NetUtils.NumBitsInAByte));
+                    | (long) value << ((length - i - 1) * NetUtils.NumBitsInAByte);
         }
         return ret;
     }
         }
         return ret;
     }
@@ -395,7 +395,7 @@ public abstract class BitBufferHelper {
                 value += 256;
             }
             ret = ret
                 value += 256;
             }
             ret = ret
-                    | (long) ((long) value << ((array.length - i - 1) * NetUtils.NumBitsInAByte));
+                    | (long) value << ((array.length - i - 1) * NetUtils.NumBitsInAByte);
         }
 
         return ret;
         }
 
         return ret;
index 566e5516eada6384247e886c042353464d3bd954..e3c46fbf6a04a113a4f0e9f95245596065f9f4cc 100644 (file)
@@ -54,11 +54,11 @@ public enum EtherTypes {
     }
 
     public static String getEtherTypeName(short number) {
     }
 
     public static String getEtherTypeName(short number) {
-        return getEtherTypeInternal((int) number & 0xffff);
+        return getEtherTypeInternal(number & 0xffff);
     }
 
     public static String getEtherTypeName(byte number) {
     }
 
     public static String getEtherTypeName(byte number) {
-        return getEtherTypeInternal((int) number & 0xff);
+        return getEtherTypeInternal(number & 0xff);
     }
 
     private static String getEtherTypeInternal(int number) {
     }
 
     private static String getEtherTypeInternal(int number) {
index 32e873bf1e9bf8506e43733e06598a158c2df4b9..0ba5476e52cb5141d9f345670aff36a03e526177 100644 (file)
@@ -295,7 +295,7 @@ public class BitBufferHelperTest {
         Assert.assertTrue(data_sh[0] == (byte) 255);
         Assert.assertTrue(data_sh[1] == (byte) 128);
 
         Assert.assertTrue(data_sh[0] == (byte) 255);
         Assert.assertTrue(data_sh[1] == (byte) 128);
 
-        data_sh = BitBufferHelper.toByteArray((int) 511, len);
+        data_sh = BitBufferHelper.toByteArray(511, len);
         Assert.assertTrue(data_sh[0] == (byte) 255);
         Assert.assertTrue(data_sh[1] == (byte) 128);
 
         Assert.assertTrue(data_sh[0] == (byte) 255);
         Assert.assertTrue(data_sh[1] == (byte) 128);