diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-10-19 13:42:32 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-10-19 13:42:32 +0200 |
commit | 8aada7b3ce5f66204d36f1fb88f1d8873d0f292d (patch) | |
tree | 892613954091a2bfc297b85154390a0b1d271253 /config-model/src/main/java/com | |
parent | 892275bf2b8f3689e44911099602e15d420ed617 (diff) |
More input tests and better error message
Diffstat (limited to 'config-model/src/main/java/com')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/RankProfile.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/RankProfile.java b/config-model/src/main/java/com/yahoo/schema/RankProfile.java index 31c68d2f2c8..cc1c87e6f47 100644 --- a/config-model/src/main/java/com/yahoo/schema/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/schema/RankProfile.java @@ -783,12 +783,13 @@ public class RankProfile implements Cloneable { // Combine Map<Reference, Input> allInputs = new LinkedHashMap<>(); + for (var inheritedProfile : inherited()) { for (var input : inheritedProfile.inputs().entrySet()) { Input existing = allInputs.get(input.getKey()); if (existing != null && ! existing.equals(input.getValue())) throw new IllegalArgumentException(this + " inherits " + inheritedProfile + " which contains " + - input.getValue() + ", but this input is already defined as " + + input.getValue() + ", but this is already defined as " + existing + " in another profile this inherits"); allInputs.put(input.getKey(), input.getValue()); } @@ -1403,8 +1404,7 @@ public class RankProfile implements Cloneable { @Override public boolean equals(Object o) { if (o == this) return true; - if ( ! (o instanceof Input)) return false; - Input other = (Input)o; + if ( ! (o instanceof Input other)) return false; if ( ! other.name().equals(this.name())) return false; if ( ! other.type().equals(this.type())) return false; if ( ! other.defaultValue().equals(this.defaultValue())) return false; @@ -1418,8 +1418,8 @@ public class RankProfile implements Cloneable { @Override public String toString() { - return "input '" + name + "' " + type + - (defaultValue().isPresent() ? ":" + defaultValue.get().toAbbreviatedString() : ""); + return "input " + name + " " + type + + (defaultValue().isPresent() ? ":" + defaultValue.get().toAbbreviatedString(false, true) : ""); } } |