src/share/classes/java/util/stream/Sink.java

Print this page
rev 7923 : 8023681: Fix raw type warning caused by Sink
Reviewed-by:

@@ -239,15 +239,14 @@
      * downstream {@code Sink}.  This implementation takes a downstream
      * {@code Sink} of unknown input shape and produces a {@code Sink<T>}.  The
      * implementation of the {@code accept()} method must call the correct
      * {@code accept()} method on the downstream {@code Sink}.
      */
-    static abstract class ChainedReference<T> implements Sink<T> {
-        @SuppressWarnings("rawtypes")
-        protected final Sink downstream;
+    static abstract class ChainedReference<T, E_OUT> implements Sink<T> {
+        protected final Sink<? super E_OUT> downstream;
 
-        public ChainedReference(Sink downstream) {
+        public ChainedReference(Sink<? super E_OUT> downstream) {
             this.downstream = Objects.requireNonNull(downstream);
         }
 
         @Override
         public void begin(long size) {

@@ -272,15 +271,14 @@
      * downstream {@code Sink}.  This implementation takes a downstream
      * {@code Sink} of unknown input shape and produces a {@code Sink.OfInt}.
      * The implementation of the {@code accept()} method must call the correct
      * {@code accept()} method on the downstream {@code Sink}.
      */
-    static abstract class ChainedInt implements Sink.OfInt {
-        @SuppressWarnings("rawtypes")
-        protected final Sink downstream;
+    static abstract class ChainedInt<E_OUT> implements Sink.OfInt {
+        protected final Sink<? super E_OUT> downstream;
 
-        public ChainedInt(Sink downstream) {
+        public ChainedInt(Sink<? super E_OUT> downstream) {
             this.downstream = Objects.requireNonNull(downstream);
         }
 
         @Override
         public void begin(long size) {

@@ -305,15 +303,14 @@
      * downstream {@code Sink}.  This implementation takes a downstream
      * {@code Sink} of unknown input shape and produces a {@code Sink.OfLong}.
      * The implementation of the {@code accept()} method must call the correct
      * {@code accept()} method on the downstream {@code Sink}.
      */
-    static abstract class ChainedLong implements Sink.OfLong {
-        @SuppressWarnings("rawtypes")
-        protected final Sink downstream;
+    static abstract class ChainedLong<E_OUT> implements Sink.OfLong {
+        protected final Sink<? super E_OUT> downstream;
 
-        public ChainedLong(Sink downstream) {
+        public ChainedLong(Sink<? super E_OUT> downstream) {
             this.downstream = Objects.requireNonNull(downstream);
         }
 
         @Override
         public void begin(long size) {

@@ -338,15 +335,14 @@
      * downstream {@code Sink}.  This implementation takes a downstream
      * {@code Sink} of unknown input shape and produces a {@code Sink.OfDouble}.
      * The implementation of the {@code accept()} method must call the correct
      * {@code accept()} method on the downstream {@code Sink}.
      */
-    static abstract class ChainedDouble implements Sink.OfDouble {
-        @SuppressWarnings("rawtypes")
-        protected final Sink downstream;
+    static abstract class ChainedDouble<E_OUT> implements Sink.OfDouble {
+        protected final Sink<? super E_OUT> downstream;
 
-        public ChainedDouble(Sink downstream) {
+        public ChainedDouble(Sink<? super E_OUT> downstream) {
             this.downstream = Objects.requireNonNull(downstream);
         }
 
         @Override
         public void begin(long size) {