diff --git a/jdk/src/share/classes/java/io/ExpiringCache.java b/jdk/src/share/classes/java/io/ExpiringCache.java index 8c07afbbc0c..42c9ce20961 100644 --- a/jdk/src/share/classes/java/io/ExpiringCache.java +++ b/jdk/src/share/classes/java/io/ExpiringCache.java @@ -35,7 +35,7 @@ import java.util.Set; class ExpiringCache { private long millisUntilExpiration; - private Map map; + private Map map; // Clear out old entries every few queries private int queryCount; private int queryOverflow = 300; @@ -61,10 +61,11 @@ class ExpiringCache { this(30000); } + @SuppressWarnings("serial") ExpiringCache(long millisUntilExpiration) { this.millisUntilExpiration = millisUntilExpiration; - map = new LinkedHashMap() { - protected boolean removeEldestEntry(Map.Entry eldest) { + map = new LinkedHashMap() { + protected boolean removeEldestEntry(Map.Entry eldest) { return size() > MAX_ENTRIES; } }; @@ -99,7 +100,7 @@ class ExpiringCache { } private Entry entryFor(String key) { - Entry entry = (Entry) map.get(key); + Entry entry = map.get(key); if (entry != null) { long delta = System.currentTimeMillis() - entry.timestamp(); if (delta < 0 || delta >= millisUntilExpiration) { @@ -111,12 +112,11 @@ class ExpiringCache { } private void cleanup() { - Set keySet = map.keySet(); + Set keySet = map.keySet(); // Avoid ConcurrentModificationExceptions String[] keys = new String[keySet.size()]; int i = 0; - for (Iterator iter = keySet.iterator(); iter.hasNext(); ) { - String key = (String) iter.next(); + for (String key: keySet) { keys[i++] = key; } for (int j = 0; j < keys.length; j++) { diff --git a/jdk/src/share/classes/java/io/LineNumberInputStream.java b/jdk/src/share/classes/java/io/LineNumberInputStream.java index d3b5d9b323c..11cfdf8b8b9 100644 --- a/jdk/src/share/classes/java/io/LineNumberInputStream.java +++ b/jdk/src/share/classes/java/io/LineNumberInputStream.java @@ -87,6 +87,7 @@ class LineNumberInputStream extends FilterInputStream { * @see java.io.FilterInputStream#in * @see java.io.LineNumberInputStream#getLineNumber() */ + @SuppressWarnings("fallthrough") public int read() throws IOException { int c = pushBack; diff --git a/jdk/src/share/classes/java/io/LineNumberReader.java b/jdk/src/share/classes/java/io/LineNumberReader.java index 31f1e87e5b6..40a0272acb8 100644 --- a/jdk/src/share/classes/java/io/LineNumberReader.java +++ b/jdk/src/share/classes/java/io/LineNumberReader.java @@ -120,6 +120,7 @@ public class LineNumberReader extends BufferedReader { * @throws IOException * If an I/O error occurs */ + @SuppressWarnings("fallthrough") public int read() throws IOException { synchronized (lock) { int c = super.read(); @@ -159,6 +160,7 @@ public class LineNumberReader extends BufferedReader { * @throws IOException * If an I/O error occurs */ + @SuppressWarnings("fallthrough") public int read(char cbuf[], int off, int len) throws IOException { synchronized (lock) { int n = super.read(cbuf, off, len); diff --git a/jdk/src/share/classes/java/io/ObjectOutputStream.java b/jdk/src/share/classes/java/io/ObjectOutputStream.java index a93ea5109cf..52e590fd78e 100644 --- a/jdk/src/share/classes/java/io/ObjectOutputStream.java +++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java @@ -1075,7 +1075,7 @@ public class ObjectOutputStream } catch (NoSuchMethodException ex) { } try { - cl.getDeclaredMethod("putFields", (Class[]) null); + cl.getDeclaredMethod("putFields", (Class[]) null); return Boolean.FALSE; } catch (NoSuchMethodException ex) { } diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java index 65bfbf46c79..893fc94ab63 100644 --- a/jdk/src/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java @@ -1049,6 +1049,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { * @param s a string of bytes to be written. * @exception IOException if an I/O error occurs. */ + @SuppressWarnings("deprecation") public final void writeBytes(String s) throws IOException { int len = s.length(); byte[] b = new byte[len];