Skip to content

Commit

Permalink
errorprone :: FieldCanBeFinal (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdahlke authored Aug 29, 2024
1 parent 51e3060 commit c792bcb
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/main/java/emissary/admin/Startup.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Startup {
static int directoryAction = DIRECTORYADD;

// If we are an emissary node these will be present
private EmissaryNode node;
private final EmissaryNode node;

// Our logger
private static final Logger logger = LoggerFactory.getLogger(Startup.class);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/client/EmissaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public class EmissaryClient {
// class is thread-safe
protected static final AuthCache AUTH_CACHE = new BasicAuthCache();

private CloseableHttpClient client;
private RequestConfig requestConfig;
private final CloseableHttpClient client;
private final RequestConfig requestConfig;
private ConnectionConfig connectionConfig;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javax.annotation.Nullable;

public class FileExistsConverter implements ITypeConverter<File> {
private String optionName;
private final String optionName;
private static final Logger LOG = LoggerFactory.getLogger(FileExistsConverter.class);

public FileExistsConverter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javax.annotation.Nullable;

public class PathExistsConverter implements ITypeConverter<Path> {
private String optionName;
private final String optionName;

public PathExistsConverter() {
this(null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/core/DiffCheckConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static class DiffCheckBuilder {
/**
* Internal state whilst building
*/
private EnumSet<DiffCheckOptions> building;
private final EnumSet<DiffCheckOptions> building;

/**
* Finish building and create the final DiffCheckConfiguration object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static SeekableByteChannelFactory create(final long size, final InputStre
}

private static class InputStreamChannelFactoryImpl implements SeekableByteChannelFactory {
private long size;
private final long size;
private final InputStreamFactory inputStreamFactory;

public InputStreamChannelFactoryImpl(final long size, final InputStreamFactory inputStreamFactory) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/kff/ChecksumCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ChecksumCalculator {
private Ssdeep ssdeep = null;

/** Used for hash calculations */
private List<MessageDigest> digest = new ArrayList<>();
private final List<MessageDigest> digest = new ArrayList<>();

/**
* Constructor initializes SHA-1 generator and turns on the CRC32 processing as well
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/kff/KffFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class KffFile implements KffFilter {
protected ByteBuffer mappedBuf;

/** Initial value of high index for binary search */
private long bSearchInitHigh;
private final long bSearchInitHigh;

public static final int DEFAULT_RECORD_LENGTH = 24;
protected final int recordLength;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/kff/KffMemcached.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class KffMemcached implements KffFilter {
/**
* Logger
*/
private Logger logger;
private final Logger logger;

/**
* The hash to use as the key
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/kff/SpamSumSignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class SpamSumSignature {
* FIELDS
*****************************************************/
private/* uint */long blockSize;
private byte[] hash1;
private byte[] hash2;
private final byte[] hash1;
private final byte[] hash2;

/*****************************************************
* UTILS
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/output/filter/JsonOutputFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class IbdoParameterFilter extends SimpleBeanPropertyFilter {
protected final boolean denylistStar;
protected final boolean emptyAllowlist;
protected final boolean allowlistStar;
private char keyReplacement = '_';
private final char keyReplacement = '_';

public IbdoParameterFilter() {
// if all collections are empty, then output everything
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import emissary.util.io.FileNameGenerator;

public class SimpleFileNameGenerator implements FileNameGenerator {
private DropOffUtil dropOffUtil;
private final DropOffUtil dropOffUtil;

/**
* Creates a file name generator for BUD files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class JournaledCoalescer implements IJournaler, ICoalescer {
/**
* The name generator to use when creating new output files *
*/
private FileNameGenerator fileNameGenerator;
private final FileNameGenerator fileNameGenerator;
/**
* The path to read input and write rolled output *
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/util/CaseInsensitiveMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CaseInsensitiveMap<K, V> extends HashMap<K, V> {
static final long serialVersionUID = -8692638820306464417L;

// For remapping string keys to through a case-insensitive layer
private Map<String, String> remap = new HashMap<>();
private final Map<String, String> remap = new HashMap<>();

/**
* Create one
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/util/UnixFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class UnixFile {
private static final Logger log = LoggerFactory.getLogger(UnixFile.class);

/** The magic number configuration file. The file which contains all magic number entries */
private List<File> magicFiles = new ArrayList<>();
private final List<File> magicFiles = new ArrayList<>();

/** The Magic number helper class */
private MagicNumberUtil util = new MagicNumberUtil();
private final MagicNumberUtil util = new MagicNumberUtil();

/** The Binary file type description */
public static final String FILETYPE_BINARY = "Binary File";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/util/io/FileFind.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class FileIterator implements Iterator {
/**
* Stack of Files and directory lists keeping track of where in the tree we are.
*/
private Deque<Object> currentPath = new ArrayDeque<>();
private final Deque<Object> currentPath = new ArrayDeque<>();
@Nullable
private FileFilter filter = null;

Expand Down Expand Up @@ -178,7 +178,7 @@ private void findNextFile() {
* the added complexity of the 'Iterator' class.
*/
static class DirectoryList {
private File[] contents;
private final File[] contents;
private int position;

public DirectoryList(File[] contents) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/util/io/ReadOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

public class ReadOutput implements Runnable {

private BufferedReader br;
private final BufferedReader br;
@Nullable
private PrintStream ps = null;
private String tag;
private final String tag;
public boolean finished = false;

public ReadOutput(InputStream is, String str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class RollableFileOutputStream extends OutputStream implements Rollable {
/** File Name Generator for creating unique file names */
FileNameGenerator namegen;
/** Directory we're writing to */
private File dir;
private final File dir;
/** Number of bytes written to file */
long bytesWritten;
/** Whether to delete a zero byte file */
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/emissary/util/search/ByteTokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
public class ByteTokenizer implements Iterator<String> {
private int currentPosition;
private int newPosition;
private int maxPosition;
private byte[] data;
private final int maxPosition;
private final byte[] data;
private String delimiters;
private boolean retDelims;
private final boolean retDelims;
private boolean delimsChanged;
private String encoding;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/util/search/KeywordScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Provides the ability to find specified {@code byte[]} patterns inside a larger {@code byte[]}.
*/
public class KeywordScanner {
private int[] skip = new int[256];
private final int[] skip = new int[256];
private int dataLength = -1;
private byte[] data;
private byte[] pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MultiKeywordScanner implements IMultiKeywordScanner {

@Nullable
private byte[] data = null;
private int[] skipTable = new int[256];
private final int[] skipTable = new int[256];
private int standardSkip = 0;
private BackwardsTreeScanner treeScanner;
private String[] keywords;
Expand Down

0 comments on commit c792bcb

Please sign in to comment.