Remove double brace initialization The build of this module was failing due to not being compliant with the errorprone setting, in particular with double brace initalization [1]. This can also be seen on the CI [2]. [1]: https://errorprone.info/bugpattern/DoubleBraceInitialization [2]: https://gerrit-ci.gerritforge.com/view/Plugins-stable-3.7/job/module-index-elasticsearch-bazel-stable-3.7/ Bug: Issue 291102095 Release-Notes: skip Change-Id: Id07f8688a4e68c0998dcf57c77f035b1e0ebc11d
diff --git a/src/main/java/com/google/gerrit/elasticsearch/ElasticSetting.java b/src/main/java/com/google/gerrit/elasticsearch/ElasticSetting.java index c054da6..2fcfc90 100644 --- a/src/main/java/com/google/gerrit/elasticsearch/ElasticSetting.java +++ b/src/main/java/com/google/gerrit/elasticsearch/ElasticSetting.java
@@ -16,7 +16,6 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.annotations.SerializedName; -import java.util.HashMap; import java.util.Map; class ElasticSetting { @@ -60,12 +59,7 @@ FieldProperties analyzer = new FieldProperties(); analyzer.customWithCharFilter = customAnalyzer; - analyzer.keywordTokenizer = - new HashMap<>() { - { - put("tokenizer", "keyword"); - } - }; + analyzer.keywordTokenizer = ImmutableMap.of("tokenizer", "keyword"); fields.put("analyzer", analyzer); return this; }