Fix Eclipse specific type casting issue (#37072)

The eclipse compiler needs some help in infering the functions return values.
This commit is contained in:
Christoph Büscher 2019-01-02 15:58:20 +01:00 committed by GitHub
parent 51cb63f934
commit 8e6f68f6b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -117,11 +117,13 @@ public class AutoFollowStats implements Writeable, ToXContentObject {
numberOfFailedRemoteClusterStateRequests = in.readVLong(); numberOfFailedRemoteClusterStateRequests = in.readVLong();
numberOfSuccessfulFollowIndices = in.readVLong(); numberOfSuccessfulFollowIndices = in.readVLong();
if (in.getVersion().onOrAfter(Version.V_6_7_0)) { if (in.getVersion().onOrAfter(Version.V_6_7_0)) {
recentAutoFollowErrors = new TreeMap<>(in.readMap(StreamInput::readString, // note: the casts to the following Writeable.Reader<T> instances are needed by some IDEs (e.g. Eclipse 4.8) as a compiler help
in1 -> new Tuple<>(in1.readZLong(), in1.readException()))); recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(in1.readZLong(), in1.readException())));
} else { } else {
recentAutoFollowErrors = new TreeMap<>(in.readMap(StreamInput::readString, // note: the casts to the following Writeable.Reader<T> instances are needed by some IDEs (e.g. Eclipse 4.8) as a compiler help
in1 -> new Tuple<>(-1L, in1.readException()))); recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(-1L, in1.readException())));
} }
if (in.getVersion().onOrAfter(Version.V_6_6_0)) { if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new)); autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new));