diff options
author | Harald Musum <musum@verizonmedia.com> | 2022-12-02 23:09:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 23:09:25 +0100 |
commit | afcf1bb71cb7b87a03149d197f724cfc7603ef92 (patch) | |
tree | fff1df3e68101edc3d3d3b98b5eb51b7758c209c /container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java | |
parent | 7f870bf3cb8dd0a3d015a448608ba7291a783932 (diff) | |
parent | fcf664e1a6bb9890bd54ff4f8b78497236152bf2 (diff) |
Merge pull request #25096 from vespa-engine/revert-25091-revert-25088-balder/immutablelist-2-listv8.94.46
Revert "Revert "Let list handling catch up with Java 17""
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java index 02a4199d32e..3da2ad53f9a 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/types/QueryProfileType.java @@ -1,12 +1,9 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.query.profile.types; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.yahoo.component.ComponentId; import com.yahoo.component.provider.FreezableSimpleComponent; import com.yahoo.processing.request.CompoundName; -import com.yahoo.search.query.profile.OverridableQueryProfile; import com.yahoo.search.query.profile.QueryProfile; import java.util.ArrayList; @@ -83,8 +80,7 @@ public class QueryProfileType extends FreezableSimpleComponent { Map<String, FieldDescription> unfrozenFields = new LinkedHashMap<>(); for (Map.Entry<String, FieldDescription> field : fields.entrySet()) { FieldDescription unfrozenFieldValue = field.getValue(); - if (field.getValue().getType() instanceof QueryProfileFieldType) { - QueryProfileFieldType queryProfileFieldType = (QueryProfileFieldType)field.getValue().getType(); + if (field.getValue().getType() instanceof QueryProfileFieldType queryProfileFieldType) { if (queryProfileFieldType.getQueryProfileType() != null) { QueryProfileFieldType unfrozenType = new QueryProfileFieldType(queryProfileFieldType.getQueryProfileType().unfrozen()); @@ -185,8 +181,8 @@ public class QueryProfileType extends FreezableSimpleComponent { fields.put(field.getName(), field); } } - fields = ImmutableMap.copyOf(fields); - inherited = ImmutableList.copyOf(inherited); + fields = Collections.unmodifiableMap(fields); + inherited = List.copyOf(inherited); strict = isStrict(); matchAsPath = getMatchAsPath(); super.freeze(); @@ -382,7 +378,7 @@ public class QueryProfileType extends FreezableSimpleComponent { */ public Map<String, String> aliases() { if (isFrozen()) return aliases; - if (aliases == null) return Collections.emptyMap(); + if (aliases == null) return Map.of(); return Collections.unmodifiableMap(aliases); } |