8300866: Declare some classes final in java.io

Reviewed-by: alanb
This commit is contained in:
Per Minborg 2023-01-23 19:09:39 +00:00
parent 1a3cb8c501
commit d117350875
5 changed files with 12 additions and 14 deletions

View File

@ -23,25 +23,23 @@
* questions.
*/
/*
*/
package java.io;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.Set;
class ExpiringCache {
final class ExpiringCache {
private static final int QUERY_OVERFLOW = 300;
private static final int MAX_ENTRIES = 200;
private final long millisUntilExpiration;
private final Map<String,Entry> map;
// Clear out old entries every few queries
private int queryCount;
static class Entry {
static final class Entry {
private long timestamp;
private String val;

View File

@ -3862,7 +3862,7 @@ public class ObjectInputStream
* as memory conservation, it does not enforce this constraint.
*/
// REMIND: add full description of exception propagation algorithm?
private static class HandleTable {
private static final class HandleTable {
/* status codes indicating whether object has associated exception */
private static final byte STATUS_OK = 1;

View File

@ -1754,7 +1754,7 @@ public class ObjectOutputStream
* bracketed by block data markers (see object serialization specification
* for details).
*/
private static class BlockDataOutputStream
private static final class BlockDataOutputStream
extends OutputStream implements DataOutput
{
/** maximum data block length */
@ -2260,7 +2260,7 @@ public class ObjectOutputStream
* Lightweight identity hash table which maps objects to integer handles,
* assigned in ascending order.
*/
private static class HandleTable {
private static final class HandleTable {
/* number of mappings in table/next available handle */
private int size;
@ -2385,7 +2385,7 @@ public class ObjectOutputStream
* Lightweight identity hash table which maps objects to replacement
* objects.
*/
private static class ReplaceTable {
private static final class ReplaceTable {
/* maps object -> index */
private final HandleTable htab;
@ -2449,7 +2449,7 @@ public class ObjectOutputStream
* Stack to keep debug information about the state of the
* serialization process, for embedding in exception messages.
*/
private static class DebugTraceInfoStack {
private static final class DebugTraceInfoStack {
private final List<String> stack;
DebugTraceInfoStack() {

View File

@ -1871,7 +1871,7 @@ public final class ObjectStreamClass implements Serializable {
* Class for computing and caching field/constructor/method signatures
* during serialVersionUID calculation.
*/
private static class MemberSignature {
private static final class MemberSignature {
public final Member member;
public final String name;
@ -1902,7 +1902,7 @@ public final class ObjectStreamClass implements Serializable {
* Class for setting and retrieving serializable field values in batch.
*/
// REMIND: dynamically generate these?
private static class FieldReflector {
private static final class FieldReflector {
/** handle for performing unsafe operations */
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

View File

@ -145,7 +145,7 @@ final class ProxyingConsole extends Console {
return delegate.charset();
}
private static class WrappingReader extends Reader {
private static final class WrappingReader extends Reader {
private final Reader r;
private final Object lock;
@ -168,7 +168,7 @@ final class ProxyingConsole extends Console {
}
}
private static class WrappingWriter extends PrintWriter {
private static final class WrappingWriter extends PrintWriter {
private final PrintWriter pw;
private final Object lock;