From 18f8f3f67a5d230aebd9cf10308cb9b543db77f6 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 13 Apr 2016 15:07:31 -0400 Subject: [PATCH] Cleanup after removing StreamableReader Javadoc and unused imports! --- .../org/elasticsearch/cluster/AbstractDiffable.java | 1 - .../org/elasticsearch/common/io/stream/Writeable.java | 11 +++++------ .../common/xcontent/FromXContentBuilder.java | 4 ---- .../cluster/serialization/DiffableTests.java | 1 - 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/AbstractDiffable.java b/core/src/main/java/org/elasticsearch/cluster/AbstractDiffable.java index 4f3cb3e7f55a0..f9d5f33cad6ca 100644 --- a/core/src/main/java/org/elasticsearch/cluster/AbstractDiffable.java +++ b/core/src/main/java/org/elasticsearch/cluster/AbstractDiffable.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.StreamableReader; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/common/io/stream/Writeable.java b/core/src/main/java/org/elasticsearch/common/io/stream/Writeable.java index 3e96a649d052c..1d98fcd6b3b8c 100644 --- a/core/src/main/java/org/elasticsearch/common/io/stream/Writeable.java +++ b/core/src/main/java/org/elasticsearch/common/io/stream/Writeable.java @@ -31,11 +31,6 @@ * * Prefer implementing this interface over implementing {@link Streamable} where possible. Lots of code depends on {@linkplain Streamable} * so this isn't always possible. - * - * The fact that this interface extends {@link StreamableReader} should be consider vestigial. Instead of using its - * {@link #readFrom(StreamInput)} method you should prefer using the Reader interface as a reference to a constructor that takes - * {@link StreamInput}. The reasoning behind this is that most "good" readFrom implementations just delegated to such a constructor anyway - * and they required an unsightly PROTOTYPE object. */ public interface Writeable { // TODO remove /** @@ -43,8 +38,12 @@ public interface Writeable { // TODO remove */ void writeTo(StreamOutput out) throws IOException; + /** + * Read this object from a stream. Use a {@link Writeable.Reader} instead. This lives on for backwards compatibility but should be + * removed before 5.0.0GA. It is not deprecated because Diffable extends this interface and it shouldn't be deprecated there. + */ default T readFrom(StreamInput in) throws IOException { - // See class javadoc for reasoning + // NORELEASE remove before 5.0.0GA throw new UnsupportedOperationException( "Prefer calling a constructor or static method that takes a StreamInput to calling readFrom."); } diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/FromXContentBuilder.java b/core/src/main/java/org/elasticsearch/common/xcontent/FromXContentBuilder.java index 51511e445c23d..0b0370b490e69 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/FromXContentBuilder.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/FromXContentBuilder.java @@ -20,15 +20,11 @@ package org.elasticsearch.common.xcontent; import org.elasticsearch.common.ParseFieldMatcher; -import org.elasticsearch.common.io.stream.StreamableReader; import java.io.IOException; /** * Indicates that the class supports XContent deserialization. - * - * This interface is similar to what {@link StreamableReader} does, only it works with XContent serialization - * instead of binary serialization. */ public interface FromXContentBuilder { /** diff --git a/core/src/test/java/org/elasticsearch/cluster/serialization/DiffableTests.java b/core/src/test/java/org/elasticsearch/cluster/serialization/DiffableTests.java index 1b21a1fc753d1..452c60545764d 100644 --- a/core/src/test/java/org/elasticsearch/cluster/serialization/DiffableTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/serialization/DiffableTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.StreamableReader; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.test.ESTestCase;