commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1487173 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Date Tue, 28 May 2013 23:56:26 GMT
Author: sebb
Date: Tue May 28 23:56:26 2013
New Revision: 1487173

URL: http://svn.apache.org/r1487173
Log:
Unnecessary @SuppressWarnings("unchecked") - these are not used for casts

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=1487173&r1=1487172&r2=1487173&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Tue May 28 23:56:26 2013
@@ -368,9 +368,8 @@ public class ZipFile {
         if (!(ze instanceof Entry)) {
             return null;
         }
-        // checked just above
-        @SuppressWarnings("unchecked") OffsetEntry offsetEntry =
-            ((Entry) ze).getOffsetEntry();
+        // cast valididty is checked just above
+        OffsetEntry offsetEntry = ((Entry) ze).getOffsetEntry();
         ZipUtil.checkRequestedFeatures(ze);
         long start = offsetEntry.dataOffset;
         BoundedInputStream bis =
@@ -896,7 +895,7 @@ public class ZipFile {
         for (Iterator<ZipArchiveEntry> it = entries.iterator(); it.hasNext(); ) {
             // entries is filled in populateFromCentralDirectory and
             // never modified
-            @SuppressWarnings("unchecked") Entry ze = (Entry) it.next();
+            Entry ze = (Entry) it.next();
             OffsetEntry offsetEntry = ze.getOffsetEntry();
             long offset = offsetEntry.headerOffset;
             archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH);
@@ -1038,10 +1037,8 @@ public class ZipFile {
                 return 0;
             }
 
-            @SuppressWarnings("unchecked") Entry ent1 =
-                e1 instanceof Entry ? (Entry) e1 : null;
-            @SuppressWarnings("unchecked") Entry ent2 =
-                e2 instanceof Entry ? (Entry) e2 : null;
+            Entry ent1 = e1 instanceof Entry ? (Entry) e1 : null;
+            Entry ent2 = e2 instanceof Entry ? (Entry) e2 : null;
             if (ent1 == null) {
                 return 1;
             }
@@ -1078,8 +1075,8 @@ public class ZipFile {
         @Override
         public boolean equals(Object other) {
             if (super.equals(other)) {
-                // super.equals would return false otherwise
-                @SuppressWarnings("unchecked") Entry otherEntry = (Entry) other;
+                // super.equals would return false if other were not an Entry
+                Entry otherEntry = (Entry) other;
                 return offsetEntry.headerOffset
                         == otherEntry.offsetEntry.headerOffset
                     && offsetEntry.dataOffset



Mime
View raw message