Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fields that should be final, as reported by SpotBugs #1268

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/htsjdk/samtools/SAMRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ public class SAMRecord implements Cloneable, Locatable, Serializable {
* Tags that are known to need the reverse complement if the read is reverse complemented.
*/
@SuppressWarnings("deprecated")
public static List<String> TAGS_TO_REVERSE_COMPLEMENT = Arrays.asList(SAMTag.E2.name(), SAMTag.SQ.name());
public static final List<String> TAGS_TO_REVERSE_COMPLEMENT = Arrays.asList(SAMTag.E2.name(), SAMTag.SQ.name());

/**
* Tags that are known to need the reverse if the read is reverse complemented.
*/
public static List<String> TAGS_TO_REVERSE = Arrays.asList(SAMTag.OQ.name(), SAMTag.U2.name());
public static final List<String> TAGS_TO_REVERSE = Arrays.asList(SAMTag.OQ.name(), SAMTag.U2.name());

private String mReadName = null;
private byte[] mReadBases = NULL_SEQUENCE;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/htsjdk/samtools/SamReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void applyTo(final SRAFileReader underlyingReader, final SamReader reader) {

};

public static EnumSet<Option> DEFAULTS = EnumSet.noneOf(Option.class);
public static final EnumSet<Option> DEFAULTS = EnumSet.noneOf(Option.class);

/** Applies this option to the provided reader, if applicable. */
void applyTo(final SamReader.PrimitiveSamReaderToSamReaderAdapter reader) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/htsjdk/samtools/cram/CRAIEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public int compare(final CRAIEntry o1, final CRAIEntry o2) {
}
};

public static Comparator<CRAIEntry> byStartDesc = new Comparator<CRAIEntry>() {
public static final Comparator<CRAIEntry> byStartDesc = new Comparator<CRAIEntry>() {

@Override
public int compare(CRAIEntry o1, CRAIEntry o2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -51,7 +52,7 @@
* @author Tim Fennell
*/
public class ReferenceSequenceFileFactory {
public static final Set<String> FASTA_EXTENSIONS = new HashSet<String>() {{
public static final Set<String> FASTA_EXTENSIONS = Collections.unmodifiableSet(new HashSet<String>() {{
add(".fasta");
add(".fasta.gz");
add(".fa");
Expand All @@ -60,7 +61,7 @@ public class ReferenceSequenceFileFactory {
add(".fna.gz");
add(".txt");
add(".txt.gz");
}};
}});

/**
* Attempts to determine the type of the reference file and return an instance
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/htsjdk/samtools/util/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

public class TestUtil {

public static int RANDOM_SEED = 42;
public static final int RANDOM_SEED = 42;


/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/htsjdk/samtools/util/ftp/FTPClient.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* Copyright (c) 2007-2011 by The Broad Institute of MIT and Harvard. All Rights Reserved.
*
Expand Down Expand Up @@ -38,7 +39,7 @@ public class FTPClient {

private Socket commandSocket = null;

public static int READ_TIMEOUT = 5 * 60 * 1000;
public static final int READ_TIMEOUT = 5 * 60 * 1000;

/**
* Stream to write commands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class IntervalIndexCreator extends TribbleIndexCreator {

public static int DEFAULT_FEATURE_COUNT = 600;
public static final int DEFAULT_FEATURE_COUNT = 600;

/**
* Maximum number of features stored per interval.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author jrobinso
*/
public class LinearIndexCreator extends TribbleIndexCreator {
public static int DEFAULT_BIN_WIDTH = 8000;
public static final int DEFAULT_BIN_WIDTH = 8000;
// the set bin width
private int binWidth = DEFAULT_BIN_WIDTH;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/htsjdk/tribble/index/tabix/TabixFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class TabixFormat implements Cloneable {
public static final int UCSC_FLAGS = GENERIC_FLAGS | ZERO_BASED;

/** Predefined headers for known formats */
public static TabixFormat GFF = new TabixFormat(GENERIC_FLAGS, 1, 4, 5, '#', 0);
public static TabixFormat BED = new TabixFormat(UCSC_FLAGS, 1, 2, 3, '#', 0);
public static TabixFormat PSLTBL = new TabixFormat(UCSC_FLAGS, 15, 17, 18, '#', 0);
public static TabixFormat SAM = new TabixFormat(SAM_FLAGS, 3, 4, 0, '@', 0);
public static TabixFormat VCF = new TabixFormat(VCF_FLAGS, 1, 2, 0, '#', 0);
public static final TabixFormat GFF = new TabixFormat(GENERIC_FLAGS, 1, 4, 5, '#', 0);
public static final TabixFormat BED = new TabixFormat(UCSC_FLAGS, 1, 2, 3, '#', 0);
public static final TabixFormat PSLTBL = new TabixFormat(UCSC_FLAGS, 15, 17, 18, '#', 0);
public static final TabixFormat SAM = new TabixFormat(SAM_FLAGS, 3, 4, 0, '@', 0);
public static final TabixFormat VCF = new TabixFormat(VCF_FLAGS, 1, 2, 0, '#', 0);

/** Describes interpretation of file being indexed. See FLAGS constants above. */
public int flags;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/htsjdk/tribble/util/ParsingUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
public class ParsingUtils {

public static Map<Object, Color> colorCache = new WeakHashMap<>(100);
public static final Map<Object, Color> colorCache = new WeakHashMap<>(100);

// HTML 4.1 color table, + orange and magenta
static Map<String, String> colorSymbols = new HashMap();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/htsjdk/tribble/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Date: 2012-Dec-13
*/
public class TestUtils {
public static String DATA_DIR = "src/test/resources/htsjdk/tribble/";
public static final String DATA_DIR = "src/test/resources/htsjdk/tribble/";

/**
* A utility method for copying a tribble file (and possibly its index) into a Jimfs-like FileSystem
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/htsjdk/variant/vcf/VCFHeaderUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,9 @@ private void checkMD5ofHeaderFile(VCFHeader header, String md5sum) {
Assert.assertEquals(md5SumFile(myTempFile), md5sum);
}

public static int VCF4headerStringCount = 16;
public static final int VCF4headerStringCount = 16;

public static String VCF4headerStrings =
public static final String VCF4headerStrings =
"##fileformat=VCFv4.2\n" +
"##filedate=2010-06-21\n" +
"##reference=NCBI36\n" +
Expand All @@ -584,7 +584,7 @@ private void checkMD5ofHeaderFile(VCFHeader header, String md5sum) {
"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n";


public static String VCF4headerStrings_with_negativeOne =
public static final String VCF4headerStrings_with_negativeOne =
"##fileformat=VCFv4.2\n" +
"##filedate=2010-06-21\n" +
"##reference=NCBI36\n" +
Expand Down