Merge "Don't inject "@GerritInstanceName Provider<String>"" into stable-3.11
diff --git a/java/com/google/gerrit/server/mail/send/BranchEmailUtils.java b/java/com/google/gerrit/server/mail/send/BranchEmailUtils.java
index 9ceb411..7f6aae7 100644
--- a/java/com/google/gerrit/server/mail/send/BranchEmailUtils.java
+++ b/java/com/google/gerrit/server/mail/send/BranchEmailUtils.java
@@ -43,8 +43,7 @@
 
     // instanceAndProjectName is the instance's name followed by the abbreviated project path
     email.addSoyParam(
-        "instanceAndProjectName",
-        getInstanceAndProjectName(args.instanceNameProvider.get(), projectName));
+        "instanceAndProjectName", getInstanceAndProjectName(args.instanceName, projectName));
     email.addSoyParam("addInstanceNameInSubject", args.addInstanceNameInSubject);
 
     email.addSoyEmailDataParam("sshHost", getSshHost(email.getGerritHost(), args.sshAddresses));
diff --git a/java/com/google/gerrit/server/mail/send/EmailArguments.java b/java/com/google/gerrit/server/mail/send/EmailArguments.java
index 578b775..6073823 100644
--- a/java/com/google/gerrit/server/mail/send/EmailArguments.java
+++ b/java/com/google/gerrit/server/mail/send/EmailArguments.java
@@ -101,7 +101,7 @@
   public final Provider<InternalAccountQuery> accountQueryProvider;
   public final OutgoingEmailValidator validator;
   public final boolean addInstanceNameInSubject;
-  public final Provider<String> instanceNameProvider;
+  public final String instanceName;
   public final Provider<CurrentUser> currentUserProvider;
   public final RetryHelper retryHelper;
 
@@ -134,7 +134,7 @@
       DynamicSet<OutgoingEmailValidationListener> outgoingEmailValidationListeners,
       Provider<InternalAccountQuery> accountQueryProvider,
       OutgoingEmailValidator validator,
-      @GerritInstanceName Provider<String> instanceNameProvider,
+      @GerritInstanceName String instanceName,
       @GerritServerConfig Config cfg,
       Provider<CurrentUser> currentUserProvider,
       RetryHelper retryHelper) {
@@ -165,7 +165,7 @@
     this.outgoingEmailValidationListeners = outgoingEmailValidationListeners;
     this.accountQueryProvider = accountQueryProvider;
     this.validator = validator;
-    this.instanceNameProvider = instanceNameProvider;
+    this.instanceName = instanceName;
     this.addInstanceNameInSubject = cfg.getBoolean("sendemail", "addInstanceNameInSubject", false);
     this.currentUserProvider = currentUserProvider;
     this.retryHelper = retryHelper;
diff --git a/java/com/google/gerrit/server/mail/send/OutgoingEmail.java b/java/com/google/gerrit/server/mail/send/OutgoingEmail.java
index aaa09cf..76b6993 100644
--- a/java/com/google/gerrit/server/mail/send/OutgoingEmail.java
+++ b/java/com/google/gerrit/server/mail/send/OutgoingEmail.java
@@ -788,7 +788,7 @@
   }
 
   private String getInstanceName() {
-    return args.instanceNameProvider.get();
+    return args.instanceName;
   }
 
   /** Renders a soy template of kind="text". */