Make fields final. Remove protected-modifier in final class

This commit is contained in:
Anosh D. Ullenius
2022-06-17 20:23:51 +02:00
parent a4e38057ae
commit 2b30d9dab0
8 changed files with 24 additions and 23 deletions
@@ -143,5 +143,5 @@ public final class Log
protected final FieldPosition _fpos = new FieldPosition(SimpleDateFormat.DATE_FIELD);
}
protected static final Level[] LEVELS = {Level.FINE, Level.INFO, Level.WARNING, Level.SEVERE};
private static final Level[] LEVELS = {Level.FINE, Level.INFO, Level.WARNING, Level.SEVERE};
}
@@ -198,7 +198,7 @@ public final class LaunchUtil
/**
* Checks whether a Java Virtual Machine can be located in the supplied path.
*/
protected static String checkJVMPath (String vmhome, boolean windebug)
private static String checkJVMPath(String vmhome, boolean windebug)
{
String vmbase = vmhome + File.separator + "bin" + File.separator;
String vmpath = vmbase + "java";
@@ -222,11 +222,11 @@ public final class LaunchUtil
}
/** Flag indicating that we're on Windows; initialized when this class is first loaded. */
protected static boolean _isWindows;
private static boolean _isWindows;
/** Flag indicating that we're on MacOS; initialized when this class is first loaded. */
protected static boolean _isMacOS;
private static boolean _isMacOS;
/** Flag indicating that we're on Linux; initialized when this class is first loaded. */
protected static boolean _isLinux;
private static boolean _isLinux;
static {
try {
@@ -140,5 +140,5 @@ public final class MessageUtil {
/** Text prefixed by this character will be considered tainted when doing recursive
* translations and won't be translated. */
protected static final String TAINT_CHAR = "~";
private static final String TAINT_CHAR = "~";
}
@@ -75,7 +75,7 @@ public class ResourceCacheTest
assertTrue(lastAccessedFile.lastModified() > lastAccessed);
}
@Rule public TemporaryFolder _folder = new TemporaryFolder();
@Rule public final TemporaryFolder _folder = new TemporaryFolder();
private File _fileToCache;
private ResourceCache _cache;
@@ -679,7 +679,7 @@ public abstract class Getdown
/** The last percentage at which we checked for another getdown running, or -1 for not
* having checked at all. */
protected int _lastCheck = -1;
private int _lastCheck = -1;
};
if (!dl.download(resources, _app.maxConcurrentDownloads())) {
// if we aborted due to detecting another getdown running, we want to report here
@@ -18,6 +18,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +71,7 @@ public class GetdownApp
File logFile = new File(envc.appDir, "launcher.log");
try {
PrintStream logOut = new PrintStream(
new BufferedOutputStream(new FileOutputStream(logFile)), true);
new BufferedOutputStream(Files.newOutputStream(logFile.toPath())), true);
System.setOut(logOut);
System.setErr(logOut);
} catch (IOException ioe) {
@@ -244,7 +245,7 @@ public class GetdownApp
});
}
protected JFrame _frame;
private JFrame _frame;
};
Getdown.run(getdown);
return getdown;
@@ -156,7 +156,7 @@ public final class ProxyPanel extends JPanel implements ActionListener
}
/** Used to look up localized messages. */
protected String get (String key)
private String get(String key)
{
// if this string is tainted, we don't translate it, instead we
// simply remove the taint character and return it to the caller
@@ -188,18 +188,18 @@ public final class ProxyPanel extends JPanel implements ActionListener
}
}
protected static Dimension clampWidth (Dimension dim, int minWidth) {
private static Dimension clampWidth(Dimension dim, int minWidth) {
dim.width = Math.max(dim.width, minWidth);
return dim;
}
protected final Getdown _getdown;
protected final ResourceBundle _msgs;
protected final boolean _updateAuth;
private final Getdown _getdown;
private final ResourceBundle _msgs;
private final boolean _updateAuth;
protected final JTextField _host;
protected final JTextField _port;
protected final JCheckBox _useAuth;
protected final JTextField _username;
protected final JPasswordField _password;
private final JTextField _host;
private final JTextField _port;
private final JCheckBox _useAuth;
private final JTextField _username;
private final JPasswordField _password;
}
@@ -372,7 +372,7 @@ public final class StatusPanel extends JComponent
protected RotatingBackgrounds _bg;
protected Dimension _psize;
protected ResourceBundle _msgs;
protected final ResourceBundle _msgs;
protected int _progress = -1;
protected String _status;
@@ -383,9 +383,9 @@ public final class StatusPanel extends JComponent
protected Label _rlabel, _newrlab;
protected UpdateInterface _ifc;
protected Timer _timer;
protected final Timer _timer;
protected long[] _remain = new long[4];
protected final long[] _remain = new long[4];
protected int _ridx;
protected Throttle _rthrottle = new Throttle(1, 1000L);