Workaround JDK 14 compiler bug (#54689)
This commit workarounds a bug in the JDK 14 compiler. It is choking on a method reference, so we substitute a lambda expression instead. The JDK bug ID is 9064309.
This commit is contained in:
parent
b138dc4565
commit
f2590b9984
|
@ -95,7 +95,11 @@ public class CustomSuggestion extends Suggest.Suggestion<CustomSuggestion.Entry>
|
||||||
static {
|
static {
|
||||||
declareCommonFields(PARSER);
|
declareCommonFields(PARSER);
|
||||||
PARSER.declareString((entry, dummy) -> entry.dummy = dummy, DUMMY);
|
PARSER.declareString((entry, dummy) -> entry.dummy = dummy, DUMMY);
|
||||||
PARSER.declareObjectArray(Entry::addOptions, (p, c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
/*
|
||||||
|
* The use of a lambda expression instead of the method reference Entry::addOptions is a workaround for a JDK 14 compiler bug.
|
||||||
|
* The bug ID is 9064309.
|
||||||
|
*/
|
||||||
|
PARSER.declareObjectArray((e, o) -> e.addOptions(o), (p, c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String dummy;
|
private String dummy;
|
||||||
|
|
|
@ -269,7 +269,11 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
|
||||||
Entry::new);
|
Entry::new);
|
||||||
static {
|
static {
|
||||||
declareCommonFields(PARSER);
|
declareCommonFields(PARSER);
|
||||||
PARSER.declareObjectArray(Entry::addOptions, (p,c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
/*
|
||||||
|
* The use of a lambda expression instead of the method reference Entry::addOptions is a workaround for a JDK 14 compiler bug.
|
||||||
|
* The bug ID is 9064309.
|
||||||
|
*/
|
||||||
|
PARSER.declareObjectArray((e, o) -> e.addOptions(o), (p,c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry fromXContent(XContentParser parser) {
|
public static Entry fromXContent(XContentParser parser) {
|
||||||
|
|
|
@ -123,7 +123,11 @@ public class PhraseSuggestion extends Suggest.Suggestion<PhraseSuggestion.Entry>
|
||||||
private static final ObjectParser<Entry, Void> PARSER = new ObjectParser<>("PhraseSuggestionEntryParser", true, Entry::new);
|
private static final ObjectParser<Entry, Void> PARSER = new ObjectParser<>("PhraseSuggestionEntryParser", true, Entry::new);
|
||||||
static {
|
static {
|
||||||
declareCommonFields(PARSER);
|
declareCommonFields(PARSER);
|
||||||
PARSER.declareObjectArray(Entry::addOptions, (p, c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
/*
|
||||||
|
* The use of a lambda expression instead of the method reference Entry::addOptions is a workaround for a JDK 14 compiler bug.
|
||||||
|
* The bug ID is 9064309.
|
||||||
|
*/
|
||||||
|
PARSER.declareObjectArray((e, o) -> e.addOptions(o), (p, c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry fromXContent(XContentParser parser) {
|
public static Entry fromXContent(XContentParser parser) {
|
||||||
|
|
|
@ -188,7 +188,11 @@ public class TermSuggestion extends Suggestion<TermSuggestion.Entry> {
|
||||||
private static final ObjectParser<Entry, Void> PARSER = new ObjectParser<>("TermSuggestionEntryParser", true, Entry::new);
|
private static final ObjectParser<Entry, Void> PARSER = new ObjectParser<>("TermSuggestionEntryParser", true, Entry::new);
|
||||||
static {
|
static {
|
||||||
declareCommonFields(PARSER);
|
declareCommonFields(PARSER);
|
||||||
PARSER.declareObjectArray(Entry::addOptions, (p,c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
/*
|
||||||
|
* The use of a lambda expression instead of the method reference Entry::addOptions is a workaround for a JDK 14 compiler bug.
|
||||||
|
* The bug ID is 9064309.
|
||||||
|
*/
|
||||||
|
PARSER.declareObjectArray((e, o) -> e.addOptions(o), (p, c) -> Option.fromXContent(p), new ParseField(OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry fromXContent(XContentParser parser) {
|
public static Entry fromXContent(XContentParser parser) {
|
||||||
|
|
Loading…
Reference in New Issue