Merge "Remove more finals from method signatures"

This commit is contained in:
Edwin Kempin
2017-06-14 08:09:23 +00:00
committed by Gerrit Code Review
27 changed files with 63 additions and 66 deletions

View File

@@ -99,12 +99,12 @@ class OpenIdServiceImpl {
@Inject @Inject
OpenIdServiceImpl( OpenIdServiceImpl(
final DynamicItem<WebSession> cf, DynamicItem<WebSession> cf,
final Provider<IdentifiedUser> iu, Provider<IdentifiedUser> iu,
CanonicalWebUrl up, CanonicalWebUrl up,
@GerritServerConfig final Config config, @GerritServerConfig Config config,
final AuthConfig ac, AuthConfig ac,
final AccountManager am, AccountManager am,
ProxyProperties proxyProperties) { ProxyProperties proxyProperties) {
if (proxyProperties.getProxyUrl() != null) { if (proxyProperties.getProxyUrl() != null) {
@@ -139,9 +139,9 @@ class OpenIdServiceImpl {
DiscoveryResult discover( DiscoveryResult discover(
HttpServletRequest req, HttpServletRequest req,
String openidIdentifier, String openidIdentifier,
final SignInMode mode, SignInMode mode,
final boolean remember, boolean remember,
final String returnToken) { String returnToken) {
final State state; final State state;
state = init(req, openidIdentifier, mode, remember, returnToken); state = init(req, openidIdentifier, mode, remember, returnToken);
if (state == null) { if (state == null) {

View File

@@ -79,7 +79,7 @@ public class JettyServer {
private final Config cfg; private final Config cfg;
@Inject @Inject
Lifecycle(JettyServer server, @GerritServerConfig final Config cfg) { Lifecycle(JettyServer server, @GerritServerConfig Config cfg) {
this.server = server; this.server = server;
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -85,10 +85,10 @@ public class ProjectQoSFilter implements Filter {
@Inject @Inject
ProjectQoSFilter( ProjectQoSFilter(
final Provider<CurrentUser> user, Provider<CurrentUser> user,
QueueProvider queue, QueueProvider queue,
final ServletContext context, ServletContext context,
@GerritServerConfig final Config cfg) { @GerritServerConfig Config cfg) {
this.user = user; this.user = user;
this.queue = queue; this.queue = queue;
this.context = context; this.context = context;
@@ -155,7 +155,7 @@ public class ProjectQoSFilter implements Filter {
private boolean done; private boolean done;
private Thread worker; private Thread worker;
TaskThunk(final WorkQueue.Executor executor, Continuation cont, HttpServletRequest req) { TaskThunk(WorkQueue.Executor executor, Continuation cont, HttpServletRequest req) {
this.executor = executor; this.executor = executor;
this.cont = cont; this.cont = cont;
this.name = generateName(req); this.name = generateName(req);

View File

@@ -29,7 +29,7 @@ public class Browser {
private final Config cfg; private final Config cfg;
@Inject @Inject
Browser(@GerritServerConfig final Config cfg) { Browser(@GerritServerConfig Config cfg) {
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -29,7 +29,7 @@ public class GerritPersonIdentProvider implements Provider<PersonIdent> {
private final String email; private final String email;
@Inject @Inject
public GerritPersonIdentProvider(@GerritServerConfig final Config cfg) { public GerritPersonIdentProvider(@GerritServerConfig Config cfg) {
String name = cfg.getString("user", null, "name"); String name = cfg.getString("user", null, "name");
if (name == null) { if (name == null) {
name = "Gerrit Code Review"; name = "Gerrit Code Review";

View File

@@ -73,7 +73,7 @@ class Helper {
@Inject @Inject
Helper( Helper(
@GerritServerConfig final Config config, @GerritServerConfig Config config,
@Named(LdapModule.PARENT_GROUPS_CACHE) Cache<String, ImmutableSet<String>> parentGroups) { @Named(LdapModule.PARENT_GROUPS_CACHE) Cache<String, ImmutableSet<String>> parentGroups) {
this.config = config; this.config = config;
this.server = LdapRealm.optional(config, "server"); this.server = LdapRealm.optional(config, "server");

View File

@@ -81,11 +81,9 @@ class LdapRealm extends AbstractRealm {
AuthConfig authConfig, AuthConfig authConfig,
EmailExpander emailExpander, EmailExpander emailExpander,
LdapGroupBackend groupBackend, LdapGroupBackend groupBackend,
@Named(LdapModule.GROUP_CACHE) @Named(LdapModule.GROUP_CACHE) LoadingCache<String, Set<AccountGroup.UUID>> membershipCache,
final LoadingCache<String, Set<AccountGroup.UUID>> membershipCache, @Named(LdapModule.USERNAME_CACHE) LoadingCache<String, Optional<Account.Id>> usernameCache,
@Named(LdapModule.USERNAME_CACHE) @GerritServerConfig Config config) {
final LoadingCache<String, Optional<Account.Id>> usernameCache,
@GerritServerConfig final Config config) {
this.helper = helper; this.helper = helper;
this.authConfig = authConfig; this.authConfig = authConfig;
this.emailExpander = emailExpander; this.emailExpander = emailExpander;

View File

@@ -24,7 +24,7 @@ public class AnonymousCowardNameProvider implements Provider<String> {
private final String anonymousCoward; private final String anonymousCoward;
@Inject @Inject
public AnonymousCowardNameProvider(@GerritServerConfig final Config cfg) { public AnonymousCowardNameProvider(@GerritServerConfig Config cfg) {
String anonymousCoward = cfg.getString("user", null, "anonymousCoward"); String anonymousCoward = cfg.getString("user", null, "anonymousCoward");
if (anonymousCoward == null) { if (anonymousCoward == null) {
anonymousCoward = DEFAULT; anonymousCoward = DEFAULT;

View File

@@ -67,7 +67,7 @@ public class AuthConfig {
private GitBasicAuthPolicy gitBasicAuthPolicy; private GitBasicAuthPolicy gitBasicAuthPolicy;
@Inject @Inject
AuthConfig(@GerritServerConfig final Config cfg) throws XsrfException { AuthConfig(@GerritServerConfig Config cfg) throws XsrfException {
authType = toType(cfg); authType = toType(cfg);
httpHeader = cfg.getString("auth", null, "httpheader"); httpHeader = cfg.getString("auth", null, "httpheader");
httpDisplaynameHeader = cfg.getString("auth", null, "httpdisplaynameheader"); httpDisplaynameHeader = cfg.getString("auth", null, "httpdisplaynameheader");

View File

@@ -23,7 +23,7 @@ public class CanonicalWebUrlProvider implements Provider<String> {
private final String canonicalUrl; private final String canonicalUrl;
@Inject @Inject
public CanonicalWebUrlProvider(@GerritServerConfig final Config config) { public CanonicalWebUrlProvider(@GerritServerConfig Config config) {
String u = config.getString("gerrit", null, "canonicalweburl"); String u = config.getString("gerrit", null, "canonicalweburl");
if (u != null && !u.endsWith("/")) { if (u != null && !u.endsWith("/")) {
u += "/"; u += "/";

View File

@@ -40,7 +40,7 @@ public class DownloadConfig {
private final ImmutableSet<ArchiveFormat> archiveFormats; private final ImmutableSet<ArchiveFormat> archiveFormats;
@Inject @Inject
DownloadConfig(@GerritServerConfig final Config cfg) { DownloadConfig(@GerritServerConfig Config cfg) {
String[] allSchemes = cfg.getStringList("download", null, "scheme"); String[] allSchemes = cfg.getStringList("download", null, "scheme");
if (allSchemes.length == 0) { if (allSchemes.length == 0) {
downloadSchemes = downloadSchemes =

View File

@@ -23,7 +23,7 @@ class EmailExpanderProvider implements Provider<EmailExpander> {
private final EmailExpander expander; private final EmailExpander expander;
@Inject @Inject
EmailExpanderProvider(@GerritServerConfig final Config cfg) { EmailExpanderProvider(@GerritServerConfig Config cfg) {
final String s = cfg.getString("auth", null, "emailformat"); final String s = cfg.getString("auth", null, "emailformat");
if (EmailExpander.Simple.canHandle(s)) { if (EmailExpander.Simple.canHandle(s)) {
expander = new EmailExpander.Simple(s); expander = new EmailExpander.Simple(s);

View File

@@ -40,7 +40,7 @@ public class TrackingFootersProvider implements Provider<TrackingFooters> {
private static final Logger log = LoggerFactory.getLogger(TrackingFootersProvider.class); private static final Logger log = LoggerFactory.getLogger(TrackingFootersProvider.class);
@Inject @Inject
TrackingFootersProvider(@GerritServerConfig final Config cfg) { TrackingFootersProvider(@GerritServerConfig Config cfg) {
for (String name : cfg.getSubsections(TRACKING_ID_TAG)) { for (String name : cfg.getSubsections(TRACKING_ID_TAG)) {
boolean configValid = true; boolean configValid = true;

View File

@@ -41,11 +41,10 @@ public class FromAddressGeneratorProvider implements Provider<FromAddressGenerat
@Inject @Inject
FromAddressGeneratorProvider( FromAddressGeneratorProvider(
@GerritServerConfig final Config cfg, @GerritServerConfig Config cfg,
@AnonymousCowardName final String anonymousCowardName, @AnonymousCowardName String anonymousCowardName,
@GerritPersonIdent final PersonIdent myIdent, @GerritPersonIdent PersonIdent myIdent,
final AccountCache accountCache) { AccountCache accountCache) {
final String from = cfg.getString("sendemail", null, "from"); final String from = cfg.getString("sendemail", null, "from");
final Address srvAddr = toAddress(myIdent); final Address srvAddr = toAddress(myIdent);

View File

@@ -74,7 +74,7 @@ public class SmtpEmailSender implements EmailSender {
private int expiryDays; private int expiryDays;
@Inject @Inject
SmtpEmailSender(@GerritServerConfig final Config cfg) { SmtpEmailSender(@GerritServerConfig Config cfg) {
enabled = cfg.getBoolean("sendemail", null, "enable", true); enabled = cfg.getBoolean("sendemail", null, "enable", true);
connectTimeout = connectTimeout =
Ints.checkedCast( Ints.checkedCast(

View File

@@ -26,7 +26,7 @@ public class DB2 extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
public DB2(@GerritServerConfig final Config cfg) { public DB2(@GerritServerConfig Config cfg) {
super("com.ibm.db2.jcc.DB2Driver"); super("com.ibm.db2.jcc.DB2Driver");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -26,7 +26,7 @@ class H2 extends BaseDataSourceType {
private final SitePaths site; private final SitePaths site;
@Inject @Inject
H2(SitePaths site, @GerritServerConfig final Config cfg) { H2(SitePaths site, @GerritServerConfig Config cfg) {
super("org.h2.Driver"); super("org.h2.Driver");
this.cfg = cfg; this.cfg = cfg;
this.site = site; this.site = site;

View File

@@ -28,7 +28,7 @@ class HANA extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
HANA(@GerritServerConfig final Config cfg) { HANA(@GerritServerConfig Config cfg) {
super("com.sap.db.jdbc.Driver"); super("com.sap.db.jdbc.Driver");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -24,7 +24,7 @@ class JDBC extends BaseDataSourceType {
protected final Config cfg; protected final Config cfg;
@Inject @Inject
JDBC(@GerritServerConfig final Config cfg) { JDBC(@GerritServerConfig Config cfg) {
super(ConfigUtil.getRequired(cfg, "database", "driver")); super(ConfigUtil.getRequired(cfg, "database", "driver"));
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -27,7 +27,7 @@ class MaxDb extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
MaxDb(@GerritServerConfig final Config cfg) { MaxDb(@GerritServerConfig Config cfg) {
super("com.sap.dbtech.jdbc.DriverSapDB"); super("com.sap.dbtech.jdbc.DriverSapDB");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -27,7 +27,7 @@ class MySql extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
MySql(@GerritServerConfig final Config cfg) { MySql(@GerritServerConfig Config cfg) {
super("com.mysql.jdbc.Driver"); super("com.mysql.jdbc.Driver");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -26,7 +26,7 @@ public class Oracle extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
public Oracle(@GerritServerConfig final Config cfg) { public Oracle(@GerritServerConfig Config cfg) {
super("oracle.jdbc.driver.OracleDriver"); super("oracle.jdbc.driver.OracleDriver");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -28,7 +28,7 @@ class PostgreSQL extends BaseDataSourceType {
private Config cfg; private Config cfg;
@Inject @Inject
PostgreSQL(@GerritServerConfig final Config cfg) { PostgreSQL(@GerritServerConfig Config cfg) {
super("org.postgresql.Driver"); super("org.postgresql.Driver");
this.cfg = cfg; this.cfg = cfg;
} }

View File

@@ -60,11 +60,11 @@ class CommandFactoryProvider implements Provider<CommandFactory>, LifecycleListe
@Inject @Inject
CommandFactoryProvider( CommandFactoryProvider(
@CommandName(Commands.ROOT) final DispatchCommandProvider d, @CommandName(Commands.ROOT) DispatchCommandProvider d,
@GerritServerConfig final Config cfg, @GerritServerConfig Config cfg,
final WorkQueue workQueue, WorkQueue workQueue,
final SshLog l, SshLog l,
final SshScope s, SshScope s,
SchemaFactory<ReviewDb> sf) { SchemaFactory<ReviewDb> sf) {
dispatcher = d; dispatcher = d;
log = l; log = l;

View File

@@ -62,14 +62,14 @@ class DatabasePubKeyAuth implements PublickeyAuthenticator {
@Inject @Inject
DatabasePubKeyAuth( DatabasePubKeyAuth(
final SshKeyCacheImpl skc, SshKeyCacheImpl skc,
final SshLog l, SshLog l,
final IdentifiedUser.GenericFactory uf, IdentifiedUser.GenericFactory uf,
final PeerDaemonUser.Factory pf, PeerDaemonUser.Factory pf,
final SitePaths site, SitePaths site,
final KeyPairProvider hostKeyProvider, KeyPairProvider hostKeyProvider,
@GerritServerConfig final Config cfg, @GerritServerConfig Config cfg,
final SshScope s) { SshScope s) {
sshKeyCache = skc; sshKeyCache = skc;
sshLog = l; sshLog = l;
userFactory = uf; userFactory = uf;
@@ -162,7 +162,7 @@ class DatabasePubKeyAuth implements PublickeyAuthenticator {
return p.keys; return p.keys;
} }
private SshKeyCacheEntry find(final Iterable<SshKeyCacheEntry> keyList, PublicKey suppliedKey) { private SshKeyCacheEntry find(Iterable<SshKeyCacheEntry> keyList, PublicKey suppliedKey) {
for (SshKeyCacheEntry k : keyList) { for (SshKeyCacheEntry k : keyList) {
if (k.match(suppliedKey)) { if (k.match(suppliedKey)) {
return k; return k;

View File

@@ -149,16 +149,16 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
@Inject @Inject
SshDaemon( SshDaemon(
final CommandFactory commandFactory, CommandFactory commandFactory,
final NoShell noShell, NoShell noShell,
final PublickeyAuthenticator userAuth, PublickeyAuthenticator userAuth,
final GerritGSSAuthenticator kerberosAuth, GerritGSSAuthenticator kerberosAuth,
final KeyPairProvider hostKeyProvider, KeyPairProvider hostKeyProvider,
final IdGenerator idGenerator, IdGenerator idGenerator,
@GerritServerConfig final Config cfg, @GerritServerConfig Config cfg,
final SshLog sshLog, SshLog sshLog,
@SshListenAddresses final List<SocketAddress> listen, @SshListenAddresses List<SocketAddress> listen,
@SshAdvertisedAddresses final List<String> advertised, @SshAdvertisedAddresses List<String> advertised,
MetricMaker metricMaker) { MetricMaker metricMaker) {
setPort(IANA_SSH_PORT /* never used */); setPort(IANA_SSH_PORT /* never used */);

View File

@@ -26,7 +26,7 @@ class StreamCommandExecutorProvider implements Provider<WorkQueue.Executor> {
private final WorkQueue queues; private final WorkQueue queues;
@Inject @Inject
StreamCommandExecutorProvider(@GerritServerConfig final Config config, WorkQueue wq) { StreamCommandExecutorProvider(@GerritServerConfig Config config, WorkQueue wq) {
final int cores = Runtime.getRuntime().availableProcessors(); final int cores = Runtime.getRuntime().availableProcessors();
poolSize = config.getInt("sshd", "streamThreads", cores + 1); poolSize = config.getInt("sshd", "streamThreads", cores + 1);
queues = wq; queues = wq;