From 9746bb20364c5fdfd182993a38fb6564012b2a3c Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 12 Nov 2012 09:43:55 +0900 Subject: [PATCH] Make a member field final wherever possible --- .../codec/http/multipart/DiskAttribute.java | 4 ++-- .../codec/http/multipart/DiskFileUpload.java | 4 ++-- .../codec/http/multipart/HttpPostBodyUtil.java | 2 +- .../http/multipart/InternalAttribute.java | 2 +- .../io/netty/util/internal/jzlib/Deflate.java | 18 +++++++++--------- .../local/LocalTransportThreadModelTest2.java | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java index 750d241ede..d32fcabf78 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java @@ -30,9 +30,9 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute { public static boolean deleteOnExitTemporaryFile = true; - public static String prefix = "Attr_"; + public static final String prefix = "Attr_"; - public static String postfix = ".att"; + public static final String postfix = ".att"; /** * Constructor used for huge Attribute diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java index 6a55b58908..ba47213fef 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java @@ -28,9 +28,9 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload { public static boolean deleteOnExitTemporaryFile = true; - public static String prefix = "FUp_"; + public static final String prefix = "FUp_"; - public static String postfix = ".tmp"; + public static final String postfix = ".tmp"; private String filename; diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java index 091ee345a4..52c149221f 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java @@ -25,7 +25,7 @@ import java.nio.charset.Charset; */ final class HttpPostBodyUtil { - public static int chunkSize = 8096; + public static final int chunkSize = 8096; /** * HTTP content disposition header name. */ diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java index 4256152038..ec4d45dea8 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/InternalAttribute.java @@ -23,7 +23,7 @@ import java.util.List; * (like Multipart Mixed mode) */ public class InternalAttribute implements InterfaceHttpData { - protected List value = new ArrayList(); + protected final List value = new ArrayList(); @Override public HttpDataType getHttpDataType() { diff --git a/common/src/main/java/io/netty/util/internal/jzlib/Deflate.java b/common/src/main/java/io/netty/util/internal/jzlib/Deflate.java index 90e0b0f913..3b46620e45 100644 --- a/common/src/main/java/io/netty/util/internal/jzlib/Deflate.java +++ b/common/src/main/java/io/netty/util/internal/jzlib/Deflate.java @@ -194,22 +194,22 @@ final class Deflate { int good_match; // Stop searching when current match exceeds this int nice_match; - short[] dyn_ltree; // literal and length tree - short[] dyn_dtree; // distance tree - short[] bl_tree; // Huffman tree for bit lengths - Tree l_desc = new Tree(); // desc for literal tree - Tree d_desc = new Tree(); // desc for distance tree - Tree bl_desc = new Tree(); // desc for bit length tree + final short[] dyn_ltree; // literal and length tree + final short[] dyn_dtree; // distance tree + final short[] bl_tree; // Huffman tree for bit lengths + final Tree l_desc = new Tree(); // desc for literal tree + final Tree d_desc = new Tree(); // desc for distance tree + final Tree bl_desc = new Tree(); // desc for bit length tree // number of codes at each bit length for an optimal tree - short[] bl_count = new short[JZlib.MAX_BITS + 1]; + final short[] bl_count = new short[JZlib.MAX_BITS + 1]; // heap used to build the Huffman trees - int[] heap = new int[2 * JZlib.L_CODES + 1]; + final int[] heap = new int[2 * JZlib.L_CODES + 1]; int heap_len; // number of elements in the heap int heap_max; // element of largest frequency // The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. // The same heap array is used to build all trees. // Depth of each subtree used as tie breaker for trees of equal frequency - byte[] depth = new byte[2 * JZlib.L_CODES + 1]; + final byte[] depth = new byte[2 * JZlib.L_CODES + 1]; int l_buf; // index for literals or lengths */ // Size of match buffer for literals/lengths. There are 4 reasons for // limiting lit_bufsize to 64K: diff --git a/transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest2.java b/transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest2.java index 1766dc3c85..b7dcaaf103 100644 --- a/transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest2.java +++ b/transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest2.java @@ -131,7 +131,7 @@ public class LocalTransportThreadModelTest2 { public volatile ChannelFuture lastWriteFuture; - public AtomicInteger count = new AtomicInteger(0); + public final AtomicInteger count = new AtomicInteger(0); public LocalHander(String name) { this.name = name;