Skip to content

Commit 31cc5ed

Browse files
nik9000javanna
authored andcommitted
Fix java 9 build
We removed a cast we needed to appease Java 9. I've recreated it in simpler form and left a comment about why we need it.
1 parent d9b13eb commit 31cc5ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ protected static QueryBuilder randomNestedFilter() {
249249

250250
@SuppressWarnings("unchecked")
251251
private T copy(T original) throws IOException {
252-
return copyWriteable(original, namedWriteableRegistry,
252+
/* The cast below is required to make Java 9 happy. Java 8 infers the T in copyWriterable to be the same as AbstractSortTestCase's
253+
* T but Java 9 infers it to be SortBuilder. */
254+
return (T) copyWriteable(original, namedWriteableRegistry,
253255
namedWriteableRegistry.getReader(SortBuilder.class, original.getWriteableName()));
254256
}
255257
}

0 commit comments

Comments
 (0)