Reorder modifiers to follow Java Language Specification

The Java Language Specification recommends listing modifiers in
the following order:

1. Annotations
2. public
3. protected
4. private
5. abstract
6. static
7. final
8. transient
9. volatile
10. synchronized
11. native
12. strictfp

Not following this convention has no technical impact, but will reduce
the code's readability because most developers are used to the standard
order.

This was detected using SonarLint.

Change-Id: I9cddecb4f4234dae1021b677e915be23d349a380
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2020-02-19 13:15:43 +09:00
parent 2d1acae6d8
commit 064834d350
46 changed files with 75 additions and 75 deletions

View File

@ -83,7 +83,7 @@ String etag(FileSender sender) throws IOException {
}
}
private static abstract class PackData extends ObjectFileServlet {
private abstract static class PackData extends ObjectFileServlet {
private static final long serialVersionUID = 1L;
PackData(String contentType) {

View File

@ -78,7 +78,7 @@ public class CleanFilter extends FilterCommand {
* The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.CleanFilter}
*/
public final static FilterCommandFactory FACTORY = CleanFilter::new;
public static final FilterCommandFactory FACTORY = CleanFilter::new;
/**
* Registers this filter by calling

View File

@ -92,7 +92,7 @@ public class SmudgeFilter extends FilterCommand {
* The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.SmudgeFilter}
*/
public final static FilterCommandFactory FACTORY = SmudgeFilter::new;
public static final FilterCommandFactory FACTORY = SmudgeFilter::new;
/**
* Register this filter in JGit

View File

@ -350,7 +350,7 @@ private static boolean included(String name, List<String> want) {
return false;
}
private static abstract class Algorithm {
private abstract static class Algorithm {
String name;
abstract DiffAlgorithm create();

View File

@ -443,7 +443,7 @@ private static class Function {
}
/** Base class for any hashCode function to be tested. */
private static abstract class Hash extends RawTextComparator {
private abstract static class Hash extends RawTextComparator {
String name;
@Override
@ -453,7 +453,7 @@ public boolean equals(RawText a, int ai, RawText b, int bi) {
}
/** Base class for any hashCode folding function to be tested. */
private static abstract class Fold {
private abstract static class Fold {
String name;
/**

View File

@ -185,7 +185,7 @@ void onCommit(String commitId, byte[] buf) {
}
}
static abstract class CommitReader {
abstract static class CommitReader {
private Process proc;
CommitReader(String[] args) throws IOException {

View File

@ -53,17 +53,17 @@
import org.junit.Test;
public class GcOrphanFilesTest extends GcTestCase {
private final static String PACK = "pack";
private static final String PACK = "pack";
private final static String BITMAP_File_1 = PACK + "-1.bitmap";
private static final String BITMAP_File_1 = PACK + "-1.bitmap";
private final static String IDX_File_2 = PACK + "-2.idx";
private static final String IDX_File_2 = PACK + "-2.idx";
private final static String IDX_File_malformed = PACK + "-1234idx";
private static final String IDX_File_malformed = PACK + "-1234idx";
private final static String PACK_File_2 = PACK + "-2.pack";
private static final String PACK_File_2 = PACK + "-2.pack";
private final static String PACK_File_3 = PACK + "-3.pack";
private static final String PACK_File_3 = PACK + "-3.pack";
private File packDir;

View File

@ -79,7 +79,7 @@ public GitDateParserBadlyFormattedTest(String dateStr) {
}
@DataPoints
static public String[] getDataPoints() {
public static String[] getDataPoints() {
return new String[] { "", "1970", "3000.3000.3000", "3 yesterday ago",
"now yesterday ago", "yesterdays", "3.day. 2.week.ago",
"day ago", "Gra Feb 21 15:35:00 2007 +0100",

View File

@ -90,7 +90,7 @@
*/
public class PullCommand extends TransportCommand<PullCommand, PullResult> {
private final static String DOT = "."; //$NON-NLS-1$
private static final String DOT = "."; //$NON-NLS-1$
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;

View File

@ -78,7 +78,7 @@ protected TranslationBundleException(String message, Class bundleClass, Locale l
*
* @return bundle class for which the exception occurred
*/
final public Class getBundleClass() {
public final Class getBundleClass() {
return bundleClass;
}
@ -87,7 +87,7 @@ final public Class getBundleClass() {
*
* @return locale for which the exception occurred
*/
final public Locale getLocale() {
public final Locale getLocale() {
return locale;
}
}

View File

@ -62,7 +62,7 @@
* @since 3.6
*/
public class FastIgnoreRule {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(FastIgnoreRule.class);
/**

View File

@ -233,7 +233,7 @@ enum PatternState {
LEADING_ASTERISK_ONLY, TRAILING_ASTERISK_ONLY, COMPLEX, NONE
}
final static List<String> POSIX_CHAR_CLASSES = Arrays.asList(
static final List<String> POSIX_CHAR_CLASSES = Arrays.asList(
"alnum", "alpha", "blank", "cntrl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
"digit", "graph", "lower", "print", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@ -248,7 +248,7 @@ enum PatternState {
private static final String DL = "\\p{javaDigit}\\p{javaLetter}"; //$NON-NLS-1$
final static List<String> JAVA_CHAR_CLASSES = Arrays
static final List<String> JAVA_CHAR_CLASSES = Arrays
.asList("\\p{Alnum}", "\\p{javaLetter}", "\\p{Blank}", "\\p{Cntrl}", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// [:alnum:] [:alpha:] [:blank:] [:cntrl:]
"\\p{javaDigit}", "[\\p{Graph}" + DL + "]", "\\p{Ll}", "[\\p{Print}" + DL + "]", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
@ -261,7 +261,7 @@ enum PatternState {
// Collating symbols [[.a.]] or equivalence class expressions [[=a=]] are
// not supported by CLI git (at least not by 1.9.1)
final static Pattern UNSUPPORTED = Pattern
static final Pattern UNSUPPORTED = Pattern
.compile("\\[\\[[.=]\\w+[.=]\\]\\]"); //$NON-NLS-1$
/**

View File

@ -705,7 +705,7 @@ public void close() {
}
/** Snapshot of packs scanned in a single pass. */
public static abstract class PackList {
public abstract static class PackList {
/** All known packs, sorted. */
public final DfsPackFile[] packs;

View File

@ -131,7 +131,7 @@
* adapted to FileRepositories.
*/
public class GC {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(GC.class);
private static final String PRUNE_EXPIRE_DEFAULT = "2.weeks.ago"; //$NON-NLS-1$

View File

@ -83,7 +83,7 @@
* name.
*/
public class LockFile {
private final static Logger LOG = LoggerFactory.getLogger(LockFile.class);
private static final Logger LOG = LoggerFactory.getLogger(LockFile.class);
/**
* Unlock the given file.

View File

@ -109,7 +109,7 @@
* considered.
*/
public class ObjectDirectory extends FileObjectDatabase {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(ObjectDirectory.class);
private static final PackList NO_PACKS = new PackList(

View File

@ -103,7 +103,7 @@
* objects are similar.
*/
public class PackFile implements Iterable<PackIndex.MutableEntry> {
private final static Logger LOG = LoggerFactory.getLogger(PackFile.class);
private static final Logger LOG = LoggerFactory.getLogger(PackFile.class);
/** Sorts PackFiles to be most recently created to least recently created. */
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
@Override

View File

@ -130,7 +130,7 @@
* overall size of a Git repository on disk.
*/
public class RefDirectory extends RefDatabase {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(RefDirectory.class);
/** Magic string denoting the start of a symbolic reference file. */
@ -1406,7 +1406,7 @@ private static interface LooseRef extends Ref {
LooseRef peel(ObjectIdRef newLeaf);
}
private final static class LoosePeeledTag extends ObjectIdRef.PeeledTag
private static final class LoosePeeledTag extends ObjectIdRef.PeeledTag
implements LooseRef {
private final FileSnapshot snapShot;
@ -1427,7 +1427,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
}
}
private final static class LooseNonTag extends ObjectIdRef.PeeledNonTag
private static final class LooseNonTag extends ObjectIdRef.PeeledNonTag
implements LooseRef {
private final FileSnapshot snapShot;
@ -1448,7 +1448,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
}
}
private final static class LooseUnpeeled extends ObjectIdRef.Unpeeled
private static final class LooseUnpeeled extends ObjectIdRef.Unpeeled
implements LooseRef {
private FileSnapshot snapShot;
@ -1483,7 +1483,7 @@ public LooseRef peel(ObjectIdRef newLeaf) {
}
}
private final static class LooseSymbolicRef extends SymbolicRef implements
private static final class LooseSymbolicRef extends SymbolicRef implements
LooseRef {
private final FileSnapshot snapShot;

View File

@ -81,7 +81,7 @@ public static PackExt[] values() {
* the file extension.
* @return the PackExt for the ext
*/
public synchronized static PackExt newPackExt(String ext) {
public static synchronized PackExt newPackExt(String ext) {
PackExt[] dst = new PackExt[VALUES.length + 1];
for (int i = 0; i < VALUES.length; i++) {
PackExt packExt = VALUES[i];

View File

@ -286,7 +286,7 @@ static int compare(
return aLen - bLen;
}
static abstract class Entry {
abstract static class Entry {
static int compare(Entry ea, Entry eb) {
byte[] a = ea.key;
byte[] b = eb.key;

View File

@ -80,7 +80,7 @@ public abstract class ReftableDatabase {
* @throws IOException
* on I/O problems.
*/
abstract protected MergedReftable openMergedReftable() throws IOException;
protected abstract MergedReftable openMergedReftable() throws IOException;
/**
* @return the next available logical timestamp for an additional reftable

View File

@ -243,11 +243,11 @@ public TreeFilter clone() {
}
}
private final static int TREE = 0;
private static final int TREE = 0;
private final static int INDEX = 1;
private static final int INDEX = 1;
private final static int WORKDIR = 2;
private static final int WORKDIR = 2;
private final Repository repository;

View File

@ -73,7 +73,7 @@ public static Inflater get() {
return r != null ? r : new Inflater(false);
}
private synchronized static Inflater getImpl() {
private static synchronized Inflater getImpl() {
if (openInflaterCount > 0) {
final Inflater r = inflaterCache[--openInflaterCount];
inflaterCache[openInflaterCount] = null;

View File

@ -355,7 +355,7 @@ private static final boolean equals(AnyObjectId firstObjectId,
}
/** Type of entry stored in the {@link ObjectIdOwnerMap}. */
public static abstract class Entry extends ObjectId {
public abstract static class Entry extends ObjectId {
transient Entry next;
/**

View File

@ -98,7 +98,7 @@ public void close() {
}
/** Wraps a delegate ObjectInserter. */
public static abstract class Filter extends ObjectInserter {
public abstract static class Filter extends ObjectInserter {
/** @return delegate ObjectInserter to handle all processing. */
protected abstract ObjectInserter delegate();

View File

@ -333,7 +333,7 @@ public ObjectStream openStream() {
*
* @since 4.10
*/
public static abstract class Filter extends ObjectLoader {
public abstract static class Filter extends ObjectLoader {
/**
* @return delegate ObjectLoader to handle all processing.
* @since 4.10

View File

@ -495,7 +495,7 @@ public int getStreamFileThreshold() {
*
* @since 4.4
*/
public static abstract class Filter extends ObjectReader {
public abstract static class Filter extends ObjectReader {
/**
* @return delegate ObjectReader to handle all processing.
* @since 4.4

View File

@ -105,7 +105,7 @@ public String toString() {
* @param token
* @return the Action
*/
static public Action parse(String token) {
public static Action parse(String token) {
for (Action action : Action.values()) {
if (action.token.equals(token)
|| action.shortToken.equals(token))

View File

@ -827,7 +827,7 @@ private static RevObject safeParseOld(RevWalk rw, AnyObjectId oldId)
* Handle the abstraction of storing a ref update. This is because both
* updating and deleting of a ref have merge testing in common.
*/
private static abstract class Store {
private abstract static class Store {
abstract Result execute(Result status) throws IOException;
}
}

View File

@ -66,7 +66,7 @@
* Cache of active {@link org.eclipse.jgit.lib.Repository} instances.
*/
public class RepositoryCache {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(RepositoryCache.class);
private static final RepositoryCache cache = new RepositoryCache();

View File

@ -83,7 +83,7 @@ public MergeAlgorithm(DiffAlgorithm diff) {
// An special edit which acts as a sentinel value by marking the end the
// list of edits
private final static Edit END_EDIT = new Edit(Integer.MAX_VALUE,
private static final Edit END_EDIT = new Edit(Integer.MAX_VALUE,
Integer.MAX_VALUE);
@SuppressWarnings("ReferenceEquality")

View File

@ -133,8 +133,8 @@ public static <T extends TranslationBundle> T getBundleFor(Class<T> type) {
return b.get(type);
}
final private Locale locale;
final private ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
private final Locale locale;
private final ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>();
private NLS(Locale locale) {
this.locale = locale;

View File

@ -58,7 +58,7 @@
* Hunk header for a hunk appearing in a "diff --cc" style patch.
*/
public class CombinedHunkHeader extends HunkHeader {
private static abstract class CombinedOldImage extends OldImage {
private abstract static class CombinedOldImage extends OldImage {
int nContext;
}

View File

@ -77,7 +77,7 @@
* The configuration file that is stored in the file of the file system.
*/
public class FileBasedConfig extends StoredConfig {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(FileBasedConfig.class);
private final File configFile;

View File

@ -2003,7 +2003,7 @@ private void release() throws IOException {
}
/** Interface for reporting status messages. */
static abstract class Reporter {
abstract static class Reporter {
abstract void sendString(String s) throws IOException;
}

View File

@ -324,7 +324,7 @@ static GeneralSecurityException securityError(String message) {
* Base implementation of JGit symmetric encryption. Supports V2 properties
* format.
*/
static abstract class SymmetricEncryption extends WalkEncryption
abstract static class SymmetricEncryption extends WalkEncryption
implements Keys, Vals {
/** Encryption profile, root name of group of related properties. */

View File

@ -275,7 +275,7 @@ public static class DefaultFileModeStrategy implements FileModeStrategy {
/**
* a singleton instance of the default FileModeStrategy
*/
public final static DefaultFileModeStrategy INSTANCE =
public static final DefaultFileModeStrategy INSTANCE =
new DefaultFileModeStrategy();
@Override
@ -308,7 +308,7 @@ public static class NoGitlinksStrategy implements FileModeStrategy {
/**
* a singleton instance of the default FileModeStrategy
*/
public final static NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
public static final NoGitlinksStrategy INSTANCE = new NoGitlinksStrategy();
@Override
public FileMode getMode(File f, FS.Attributes attributes) {

View File

@ -1180,7 +1180,7 @@ private byte[] computeHash(InputStream in, long length) throws IOException {
*
* @since 5.0
*/
public static abstract class Entry {
public abstract static class Entry {
byte[] encodedName;
int encodedNameLen;

View File

@ -28,26 +28,26 @@
*/
public class Base64 {
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte) '=';
private static final byte EQUALS_SIGN = (byte) '=';
/** Indicates equals sign in encoding. */
private final static byte EQUALS_SIGN_DEC = -1;
private static final byte EQUALS_SIGN_DEC = -1;
/** Indicates white space in encoding. */
private final static byte WHITE_SPACE_DEC = -2;
private static final byte WHITE_SPACE_DEC = -2;
/** Indicates an invalid byte during decoding. */
private final static byte INVALID_DEC = -3;
private static final byte INVALID_DEC = -3;
/** The 64 valid Base64 values. */
private final static byte[] ENC;
private static final byte[] ENC;
/**
* Translates a Base64 value to either its 6-bit reconstruction value or a
* negative number indicating some other meaning. The table is only 7 bits
* wide, as the 8th bit is discarded during decoding.
*/
private final static byte[] DEC;
private static final byte[] DEC;
static {
ENC = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" // //$NON-NLS-1$

View File

@ -213,7 +213,7 @@ public int getRc() {
*
* @since 5.1.9
*/
public final static class FileStoreAttributes {
public static final class FileStoreAttributes {
private static final Duration UNDEFINED_DURATION = Duration
.ofNanos(Long.MAX_VALUE);
@ -691,7 +691,7 @@ public String toString() {
/** The auto-detected implementation selected for this operating system and JRE. */
public static final FS DETECTED = detect();
private volatile static FSFactory factory;
private static volatile FSFactory factory;
/**
* Auto-detect the appropriate file system abstraction.

View File

@ -85,7 +85,7 @@
* @since 3.0
*/
public class FS_POSIX extends FS {
private final static Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
private static final Logger LOG = LoggerFactory.getLogger(FS_POSIX.class);
private static final int DEFAULT_UMASK = 0022;
private volatile int umask = -1;

View File

@ -72,7 +72,7 @@
* @since 3.0
*/
public class FS_Win32 extends FS {
private final static Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
private static final Logger LOG = LoggerFactory.getLogger(FS_Win32.class);
/**
* Constructor

View File

@ -65,7 +65,7 @@
* @since 3.0
*/
public class FS_Win32_Cygwin extends FS_Win32 {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(FS_Win32_Cygwin.class);
private static String cygpath;

View File

@ -33,7 +33,7 @@
* @since 5.1.13
*/
public class Monitoring {
private final static Logger LOG = LoggerFactory.getLogger(Monitoring.class);
private static final Logger LOG = LoggerFactory.getLogger(Monitoring.class);
/**
* Register a MBean with the platform MBean server

View File

@ -52,19 +52,19 @@
* in the format defined by {@code git log --relative-date}.
*/
public class RelativeDateFormatter {
final static long SECOND_IN_MILLIS = 1000;
static final long SECOND_IN_MILLIS = 1000;
final static long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
static final long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
final static long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
static final long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
final static long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
static final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
final static long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
static final long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
final static long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
static final long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
final static long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
static final long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
/**
* Get age of given {@link java.util.Date} compared to now formatted in the

View File

@ -85,7 +85,7 @@
*/
public abstract class SystemReader {
private final static Logger LOG = LoggerFactory
private static final Logger LOG = LoggerFactory
.getLogger(SystemReader.class);
private static final SystemReader DEFAULT;