Make private fields final (#1005)

This commit is contained in:
Simon Legner
2025-03-19 22:18:17 +01:00
committed by GitHub
parent cea67fef73
commit 995de2da99
15 changed files with 34 additions and 34 deletions

View File

@@ -28,7 +28,7 @@ public class IdentificationStringParser {
private final Logger log; private final Logger log;
private final Buffer.PlainBuffer buffer; private final Buffer.PlainBuffer buffer;
private byte[] EXPECTED_START_BYTES = new byte[] {'S', 'S', 'H', '-'}; private final byte[] EXPECTED_START_BYTES = new byte[] {'S', 'S', 'H', '-'};
public IdentificationStringParser(Buffer.PlainBuffer buffer) { public IdentificationStringParser(Buffer.PlainBuffer buffer) {
this(buffer, LoggerFactory.DEFAULT); this(buffer, LoggerFactory.DEFAULT);

View File

@@ -121,11 +121,11 @@ public class BlockCiphers {
public static class Factory public static class Factory
implements net.schmizz.sshj.common.Factory.Named<Cipher> { implements net.schmizz.sshj.common.Factory.Named<Cipher> {
private int keysize; private final int keysize;
private String cipher; private final String cipher;
private String mode; private final String mode;
private String name; private final String name;
private int ivsize; private final int ivsize;
/** /**
* @param ivsize * @param ivsize

View File

@@ -33,12 +33,12 @@ public class GcmCiphers {
public static class Factory public static class Factory
implements net.schmizz.sshj.common.Factory.Named<Cipher> { implements net.schmizz.sshj.common.Factory.Named<Cipher> {
private int keysize; private final int keysize;
private int authSize; private final int authSize;
private String cipher; private final String cipher;
private String mode; private final String mode;
private String name; private final String name;
private int ivsize; private final int ivsize;
/** /**
* @param ivsize * @param ivsize

View File

@@ -40,10 +40,10 @@ public class StreamCiphers {
public static class Factory public static class Factory
implements net.schmizz.sshj.common.Factory.Named<Cipher> { implements net.schmizz.sshj.common.Factory.Named<Cipher> {
private int keysize; private final int keysize;
private String cipher; private final String cipher;
private String mode; private final String mode;
private String name; private final String name;
/** /**
* @param keysize The keysize used in bits. * @param keysize The keysize used in bits.

View File

@@ -28,8 +28,8 @@ import java.security.GeneralSecurityException;
* *
*/ */
public class DHG extends AbstractDHG { public class DHG extends AbstractDHG {
private BigInteger group; private final BigInteger group;
private BigInteger generator; private final BigInteger generator;
public DHG(BigInteger group, BigInteger generator, Digest digest) { public DHG(BigInteger group, BigInteger generator, Digest digest) {
super(new DH(), digest); super(new DH(), digest);

View File

@@ -68,10 +68,10 @@ public class DHGroups {
public static class Factory public static class Factory
implements net.schmizz.sshj.common.Factory.Named<KeyExchange> { implements net.schmizz.sshj.common.Factory.Named<KeyExchange> {
private String name; private final String name;
private BigInteger group; private final BigInteger group;
private BigInteger generator; private final BigInteger generator;
private Factory.Named<Digest> digestFactory; private final Factory.Named<Digest> digestFactory;
public Factory(String name, BigInteger group, BigInteger generator, Named<Digest> digestFactory) { public Factory(String name, BigInteger group, BigInteger generator, Named<Digest> digestFactory) {
this.name = name; this.name = name;

View File

@@ -71,10 +71,10 @@ public class Macs {
public static class Factory implements net.schmizz.sshj.common.Factory.Named<MAC> { public static class Factory implements net.schmizz.sshj.common.Factory.Named<MAC> {
private String name; private final String name;
private String algorithm; private final String algorithm;
private int bSize; private final int bSize;
private int defBSize; private final int defBSize;
private final boolean etm; private final boolean etm;
public Factory(String name, String algorithm, int bSize, int defBSize, boolean etm) { public Factory(String name, String algorithm, int bSize, int defBSize, boolean etm) {

View File

@@ -57,7 +57,7 @@ public class KnownHostMatchers {
} }
private static class EquiHostMatcher implements HostMatcher { private static class EquiHostMatcher implements HostMatcher {
private String host; private final String host;
public EquiHostMatcher(String host) { public EquiHostMatcher(String host) {
this.host = host; this.host = host;

View File

@@ -37,7 +37,7 @@ public final class ChannelOutputStream extends OutputStream implements ErrorNoti
private final DataBuffer buffer = new DataBuffer(); private final DataBuffer buffer = new DataBuffer();
private final byte[] b = new byte[1]; private final byte[] b = new byte[1];
private AtomicBoolean closed; private final AtomicBoolean closed;
private SSHException error; private SSHException error;
private final class DataBuffer { private final class DataBuffer {

View File

@@ -77,7 +77,7 @@ public class SignatureECDSA extends AbstractSignatureDSA {
} }
private String keyTypeName; private final String keyTypeName;
public SignatureECDSA(String algorithm, String keyTypeName) { public SignatureECDSA(String algorithm, String keyTypeName) {
super(algorithm, keyTypeName); super(algorithm, keyTypeName);

View File

@@ -87,7 +87,7 @@ public class SignatureRSA
} }
private KeyType keyType; private final KeyType keyType;
public SignatureRSA(String algorithm, KeyType keyType, String name) { public SignatureRSA(String algorithm, KeyType keyType, String name) {

View File

@@ -25,7 +25,7 @@ import java.security.spec.ECGenParameterSpec;
public class ECDHNistP extends AbstractDHG { public class ECDHNistP extends AbstractDHG {
private String curve; private final String curve;
/** Named factory for ECDHNistP key exchange */ /** Named factory for ECDHNistP key exchange */
public static class Factory521 public static class Factory521

View File

@@ -475,7 +475,7 @@ public class OpenSSHKnownHosts
} }
public static class BadHostEntry implements KnownHostEntry { public static class BadHostEntry implements KnownHostEntry {
private String line; private final String line;
public BadHostEntry(String line) { public BadHostEntry(String line) {
this.line = line; this.line = line;

View File

@@ -101,7 +101,7 @@ public class PuTTYKeyFile extends BaseFileKeyProvider {
throw new IOException(String.format("Unsupported encryption: %s", encryption)); throw new IOException(String.format("Unsupported encryption: %s", encryption));
} }
private Map<String, String> payload = new HashMap<String, String>(); private final Map<String, String> payload = new HashMap<String, String>();
/** /**
* For each line that looks like "Xyz: vvv", it will be stored in this map. * For each line that looks like "Xyz: vvv", it will be stored in this map.

View File

@@ -71,7 +71,7 @@ public class ScpCommandLine {
} }
} }
private LinkedHashMap<Arg, String> arguments = new LinkedHashMap<Arg, String>(); private final LinkedHashMap<Arg, String> arguments = new LinkedHashMap<Arg, String>();
private String path; private String path;
ScpCommandLine() { ScpCommandLine() {