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/QueryProfile.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/QueryProfile.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java index e3ab49f0e32..b58bd64209b 100644 --- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java +++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfile.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.query.profile; -import com.google.common.collect.ImmutableList; import com.yahoo.component.ComponentId; import com.yahoo.component.provider.FreezableSimpleComponent; import com.yahoo.processing.IllegalInputException; @@ -420,7 +419,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable content.freeze(); - inherited= inherited==null ? ImmutableList.of() : ImmutableList.copyOf(inherited); + inherited= inherited==null ? List.of() : List.copyOf(inherited); super.freeze(); } @@ -616,8 +615,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable * be added (usually because the new value was added to the existing). */ static Object combineValues(Object newValue, Object existingValue) { - if (newValue instanceof QueryProfile) { - QueryProfile newProfile = (QueryProfile)newValue; + if (newValue instanceof QueryProfile newProfile) { if ( ! (existingValue instanceof QueryProfile)) { if ( ! isModifiable(newProfile)) { // Make the query profile reference overridable @@ -631,8 +629,7 @@ public class QueryProfile extends FreezableSimpleComponent implements Cloneable return combineProfiles(newProfile, (QueryProfile)existingValue); } else { - if (existingValue instanceof QueryProfile) { // we need to set a non-leaf value on a query profile - QueryProfile existingProfile = (QueryProfile)existingValue; + if (existingValue instanceof QueryProfile existingProfile) { // we need to set a non-leaf value on a query profile if (isModifiable(existingProfile)) { existingProfile.setValue(newValue); return null; |