From 8fdeedf61daa421cc774eed8faeb2358b205ed9d Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Thu, 5 Jan 2017 16:23:16 +0000 Subject: [PATCH] fix generics compile error in Eclipse Eclipse compiler needs a hint to tell it the generics for the comparator function Original commit: elastic/x-pack-elasticsearch@b3d71d34654ba70d98a8c73fd584724040cda661 --- .../xpack/prelert/scheduler/SchedulerConfig.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java index a56be204551..94b4c4cf2b4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java @@ -39,6 +39,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.function.Function; /** * Scheduler configuration options. Describes where to proactively pull input @@ -98,7 +99,7 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable { while (p.nextToken() != XContentParser.Token.END_OBJECT) { parsedScriptFields.add(new SearchSourceBuilder.ScriptField(new QueryParseContext(p, ParseFieldMatcher.STRICT))); } - Collections.sort(parsedScriptFields, Comparator.comparing(f -> f.fieldName())); + Collections.sort(parsedScriptFields, Comparator.comparing((Function) f -> f.fieldName())); return parsedScriptFields; }, SCRIPT_FIELDS); PARSER.declareInt(Builder::setScrollSize, SCROLL_SIZE); @@ -431,7 +432,7 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable { public void setScriptFields(List scriptFields) { List sorted = new ArrayList<>(scriptFields); - Collections.sort(sorted, Comparator.comparing(f -> f.fieldName())); + Collections.sort(sorted, Comparator.comparing((Function) f -> f.fieldName())); this.scriptFields = sorted; }