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 ChannelConfig config = new DefaultChannelConfig();
private final ChannelConfig config = new DefaultChannelConfig();
@Override
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_1_5(SerialPort.STOPBITS_1_5);
private int value;
private final int value;
private Stopbits(int value) {
this.value = value;
@ -61,7 +61,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
DATABITS_7(SerialPort.DATABITS_7),
DATABITS_8(SerialPort.DATABITS_8);
private int value;
private final int value;
private Databits(int value) {
this.value = value;
@ -89,7 +89,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
MARK(SerialPort.PARITY_MARK),
SPACE(SerialPort.PARITY_SPACE);
private int value;
private final int value;
private Paritybit(int value) {
this.value = value;

View File

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

View File

@ -404,7 +404,7 @@ public class HttpClient {
// 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"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+
@ -992,4 +992,4 @@ public class HttpClient {
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n";
}
}

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
/**
* 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>>();
/**
* 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 protocol = null;
private final String protocol = null;
private boolean allowExtensions = false;

View File

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

View File

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