FS: cleanup use of final modifier

See the contributor guide [1].

[1] https://wiki.eclipse.org/EGit/Contributor_Guide#Use_of_the_.22final.22_modifier

Change-Id: I4673442310a3a53d838407f7eb11964144bb04d0
This commit is contained in:
Matthias Sohn 2021-08-13 09:47:34 +02:00
parent 5fb71fb54e
commit aad1bde522
1 changed files with 16 additions and 17 deletions

View File

@ -524,7 +524,7 @@ private static void write(Path p, String body) throws IOException {
}
private static String read(Path p) throws IOException {
final byte[] body = IO.readFully(p.toFile());
byte[] body = IO.readFully(p.toFile());
return new String(body, 0, body.length, UTF_8);
}
@ -766,7 +766,7 @@ private static void saveToConfig(FileStore s,
}
private static String getConfigKey(FileStore s) {
final String storeKey;
String storeKey;
if (SystemReader.getInstance().isWindows()) {
Object attribute = null;
try {
@ -1164,7 +1164,7 @@ public void delete(File f) throws IOException {
* platform does not require path name translation.
*/
public File resolve(File dir, String name) {
final File abspn = new File(name);
File abspn = new File(name);
if (abspn.isAbsolute())
return abspn;
return new File(dir, name);
@ -1257,7 +1257,7 @@ protected File userHomeImpl() {
}
private File defaultUserHomeImpl() {
final String home = AccessController.doPrivileged(
String home = AccessController.doPrivileged(
(PrivilegedAction<String>) () -> System.getProperty("user.home") //$NON-NLS-1$
);
if (home == null || home.length() == 0)
@ -1284,7 +1284,7 @@ protected static File searchPath(String path, String... lookFor) {
for (String p : path.split(File.pathSeparator)) {
for (String command : lookFor) {
final File file = new File(p, command);
File file = new File(p, command);
try {
if (file.isFile() && file.canExecute()) {
return file.getAbsoluteFile();
@ -1341,7 +1341,7 @@ protected static String readPipe(File dir, String[] command,
protected static String readPipe(File dir, String[] command,
String encoding, Map<String, String> env)
throws CommandFailedException {
final boolean debug = LOG.isDebugEnabled();
boolean debug = LOG.isDebugEnabled();
try {
if (debug) {
LOG.debug("readpipe " + Arrays.asList(command) + "," //$NON-NLS-1$ //$NON-NLS-2$
@ -1808,11 +1808,11 @@ public String relativize(String base, String other) {
* @since 5.0
*/
public Entry[] list(File directory, FileModeStrategy fileModeStrategy) {
final File[] all = directory.listFiles();
File[] all = directory.listFiles();
if (all == null) {
return NO_ENTRIES;
}
final Entry[] result = new Entry[all.length];
Entry[] result = new Entry[all.length];
for (int i = 0; i < result.length; i++) {
result[i] = new FileEntry(all[i], this, fileModeStrategy);
}
@ -1842,10 +1842,9 @@ public Entry[] list(File directory, FileModeStrategy fileModeStrategy) {
* @since 4.0
*/
public ProcessResult runHookIfPresent(Repository repository,
final String hookName,
String[] args) throws JGitInternalException {
return runHookIfPresent(repository, hookName, args, System.out, System.err,
null);
String hookName, String[] args) throws JGitInternalException {
return runHookIfPresent(repository, hookName, args, System.out,
System.err, null);
}
/**
@ -1877,9 +1876,9 @@ public ProcessResult runHookIfPresent(Repository repository,
* @since 5.11
*/
public ProcessResult runHookIfPresent(Repository repository,
final String hookName,
String[] args, OutputStream outRedirect, OutputStream errRedirect,
String stdinArgs) throws JGitInternalException {
String hookName, String[] args, OutputStream outRedirect,
OutputStream errRedirect, String stdinArgs)
throws JGitInternalException {
return new ProcessResult(Status.NOT_SUPPORTED);
}
@ -1913,7 +1912,7 @@ public ProcessResult runHookIfPresent(Repository repository,
* @since 5.11
*/
protected ProcessResult internalRunHookIfPresent(Repository repository,
final String hookName, String[] args, OutputStream outRedirect,
String hookName, String[] args, OutputStream outRedirect,
OutputStream errRedirect, String stdinArgs)
throws JGitInternalException {
File hookFile = findHook(repository, hookName);
@ -2109,7 +2108,7 @@ public int runProcess(ProcessBuilder processBuilder,
OutputStream outRedirect, OutputStream errRedirect,
InputStream inRedirect) throws IOException,
InterruptedException {
final ExecutorService executor = Executors.newFixedThreadPool(2);
ExecutorService executor = Executors.newFixedThreadPool(2);
Process process = null;
// We'll record the first I/O exception that occurs, but keep on trying
// to dispose of our open streams and file handles