Make fields final where possible.

This commit is contained in:
Craig P. Motlin 2011-11-09 08:33:45 -05:00
parent 8d6d2f038e
commit 1fdab7bb95
11 changed files with 20 additions and 20 deletions

View File

@ -115,7 +115,7 @@ public class IOStreamChannelSink extends AbstractChannelSink {
private PushbackInputStream inputStream; private PushbackInputStream inputStream;
private ChannelConfig config = new DefaultChannelConfig(); private final ChannelConfig config = new DefaultChannelConfig();
@Override @Override
public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception { public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception {

View File

@ -34,7 +34,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
STOPBITS_2(SerialPort.STOPBITS_2), STOPBITS_2(SerialPort.STOPBITS_2),
STOPBITS_1_5(SerialPort.STOPBITS_1_5); STOPBITS_1_5(SerialPort.STOPBITS_1_5);
private int value; private final int value;
private Stopbits(int value) { private Stopbits(int value) {
this.value = value; this.value = value;
@ -61,7 +61,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
DATABITS_7(SerialPort.DATABITS_7), DATABITS_7(SerialPort.DATABITS_7),
DATABITS_8(SerialPort.DATABITS_8); DATABITS_8(SerialPort.DATABITS_8);
private int value; private final int value;
private Databits(int value) { private Databits(int value) {
this.value = value; this.value = value;
@ -89,7 +89,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
MARK(SerialPort.PARITY_MARK), MARK(SerialPort.PARITY_MARK),
SPACE(SerialPort.PARITY_SPACE); SPACE(SerialPort.PARITY_SPACE);
private int value; private final int value;
private Paritybit(int value) { private Paritybit(int value) {
this.value = value; this.value = value;

View File

@ -32,9 +32,9 @@ import java.util.concurrent.atomic.AtomicLong;
* @author OneDrum Ltd. * @author OneDrum Ltd.
*/ */
class SaturationManager { class SaturationManager {
private AtomicLong desaturationPoint; private final AtomicLong desaturationPoint;
private AtomicLong saturationPoint; private final AtomicLong saturationPoint;
private final AtomicLong queueSize; private final AtomicLong queueSize;

View File

@ -404,7 +404,7 @@ public class HttpClient {
// use to simulate a big TEXTAREA field in a form // use to simulate a big TEXTAREA field in a form
private static String textArea = private static final String textArea =
"lkjlkjlKJLKJLKJLKJLJlkj lklkj\r\n\r\nLKJJJJJJJJKKKKKKKKKKKKKKK <20><><EFBFBD><EFBFBD>&\r\n\r\n"+ "lkjlkjlKJLKJLKJLKJLJlkj lklkj\r\n\r\nLKJJJJJJJJKKKKKKKKKKKKKKK <20><><EFBFBD><EFBFBD>&\r\n\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+ "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+ "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+

View File

@ -44,7 +44,7 @@ import java.util.concurrent.Executors;
*/ */
public class WebSocketClientFactory { public class WebSocketClientFactory {
private NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory( private final NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
/** /**

View File

@ -51,12 +51,12 @@ import org.jboss.netty.util.CharsetUtil;
*/ */
public class WebSocketClientHandler extends SimpleChannelUpstreamHandler implements WebSocketClient { public class WebSocketClientHandler extends SimpleChannelUpstreamHandler implements WebSocketClient {
private ClientBootstrap bootstrap; private final ClientBootstrap bootstrap;
private URI url; private URI url;
private WebSocketCallback callback; private final WebSocketCallback callback;
private Channel channel; private Channel channel;
private WebSocketClientHandshaker handshaker = null; private WebSocketClientHandshaker handshaker = null;
private WebSocketSpecificationVersion version; private final WebSocketSpecificationVersion version;
public WebSocketClientHandler(ClientBootstrap bootstrap, URI url, WebSocketSpecificationVersion version, WebSocketCallback callback) { public WebSocketClientHandler(ClientBootstrap bootstrap, URI url, WebSocketSpecificationVersion version, WebSocketCallback callback) {
this.bootstrap = bootstrap; this.bootstrap = bootstrap;

View File

@ -48,7 +48,7 @@ public final class LocalTimeProtocol {
internalGetValueMap() { internalGetValueMap() {
return internalValueMap; return internalValueMap;
} }
private static com.google.protobuf.Internal.EnumLiteMap<Continent> private static final com.google.protobuf.Internal.EnumLiteMap<Continent>
internalValueMap = internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<Continent>() { new com.google.protobuf.Internal.EnumLiteMap<Continent>() {
public Continent findValueByNumber(int number) { public Continent findValueByNumber(int number) {
@ -125,7 +125,7 @@ public final class LocalTimeProtocol {
internalGetValueMap() { internalGetValueMap() {
return internalValueMap; return internalValueMap;
} }
private static com.google.protobuf.Internal.EnumLiteMap<DayOfWeek> private static final com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>
internalValueMap = internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>() { new com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>() {
public DayOfWeek findValueByNumber(int number) { public DayOfWeek findValueByNumber(int number) {

View File

@ -50,7 +50,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
/** /**
* Keep all HttpDatas until cleanAllHttpDatas() is called. * Keep all HttpDatas until cleanAllHttpDatas() is called.
*/ */
private ConcurrentHashMap<HttpRequest, List<HttpData>> requestFileDeleteMap = private final ConcurrentHashMap<HttpRequest, List<HttpData>> requestFileDeleteMap =
new ConcurrentHashMap<HttpRequest, List<HttpData>>(); new ConcurrentHashMap<HttpRequest, List<HttpData>>();
/** /**
* HttpData will be in memory if less than default size (16KB). * HttpData will be in memory if less than default size (16KB).

View File

@ -49,7 +49,7 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker {
private String expectedChallengeResponseString = null; private String expectedChallengeResponseString = null;
private String protocol = null; private final String protocol = null;
private boolean allowExtensions = false; private boolean allowExtensions = false;

View File

@ -30,9 +30,9 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
*/ */
public class WebSocketServerHandshakerFactory { public class WebSocketServerHandshakerFactory {
private String webSocketURL; private final String webSocketURL;
private String subProtocols; private final String subProtocols;
private boolean allowExtensions = false; private boolean allowExtensions = false;

View File

@ -85,7 +85,7 @@ public class HttpTunnelSoakTester {
final DataVerifier s2cVerifier = new DataVerifier("S2C-Verifier"); final DataVerifier s2cVerifier = new DataVerifier("S2C-Verifier");
private static byte[] SEND_STREAM; private static final byte[] SEND_STREAM;
static { static {
SEND_STREAM = new byte[MAX_WRITE_SIZE + 127]; SEND_STREAM = new byte[MAX_WRITE_SIZE + 127];