This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new 1462ccd18b chore: Remove Source#future in javadsl (#2554)
1462ccd18b is described below

commit 1462ccd18b9222328730879fffbd46e230d53863
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Mar 6 12:25:46 2026 +0800

    chore: Remove Source#future in javadsl (#2554)
---
 .../pekko/stream/javadsl/LazyAndFutureSourcesTest.java       | 10 ----------
 .../apache/pekko/stream/DslFactoriesConsistencySpec.scala    |  2 ++
 .../remove-deprecated-methods.excludes                       |  1 +
 .../main/scala/org/apache/pekko/stream/javadsl/Source.scala  | 12 +-----------
 4 files changed, 4 insertions(+), 21 deletions(-)

diff --git 
a/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/LazyAndFutureSourcesTest.java
 
b/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/LazyAndFutureSourcesTest.java
index b84fee1685..726656efad 100644
--- 
a/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/LazyAndFutureSourcesTest.java
+++ 
b/stream-tests/src/test/java/org/apache/pekko/stream/javadsl/LazyAndFutureSourcesTest.java
@@ -27,7 +27,6 @@ import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
 import org.apache.pekko.testkit.PekkoSpec;
 import org.junit.ClassRule;
 import org.junit.Test;
-import scala.concurrent.Future;
 
 public class LazyAndFutureSourcesTest extends StreamTest {
 
@@ -41,15 +40,6 @@ public class LazyAndFutureSourcesTest extends StreamTest {
 
   // note these are minimal happy path tests to cover API, more thorough tests 
are on the Scala side
 
-  @Test
-  @SuppressWarnings("deprecation")
-  public void future() throws Exception {
-    CompletionStage<List<String>> result =
-        Source.future(Future.successful("one")).runWith(Sink.seq(), system);
-
-    assertEquals(Arrays.asList("one"), result.toCompletableFuture().get(3, 
TimeUnit.SECONDS));
-  }
-
   @Test
   public void completionStage() throws Exception {
     CompletionStage<String> one = CompletableFuture.completedFuture("one");
diff --git 
a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala
 
b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala
index a2c30e7347..3481be78ea 100644
--- 
a/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala
+++ 
b/stream-tests/src/test/scala/org/apache/pekko/stream/DslFactoriesConsistencySpec.scala
@@ -56,6 +56,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with 
Matchers {
     ("apply" -> "fromIterator") ::
     ("apply" -> "fromFunctions") ::
     ("apply" -> "fromArray") ::
+    ("future" -> "completionStage") ::
     Nil
 
   // format: OFF
@@ -75,6 +76,7 @@ class DslFactoriesConsistencySpec extends AnyWordSpec with 
Matchers {
       (classOf[scala.Function2[_, _, _]],                  
classOf[java.util.function.BiFunction[_, _, _]]) :: // setup
       (classOf[scala.Function1[scala.Function1[_, _], _]], 
classOf[pekko.japi.function.Function2[_, _, _]]) ::
       (classOf[scala.concurrent.duration.FiniteDuration],  
classOf[java.time.Duration]) ::
+      (classOf[scala.concurrent.Future[_]],                
classOf[java.util.concurrent.CompletionStage[_]]) ::
       (classOf[pekko.stream.scaladsl.Source[_, _]],        
classOf[pekko.stream.javadsl.Source[_, _]]) ::
       (classOf[pekko.stream.scaladsl.Sink[_, _]],          
classOf[pekko.stream.javadsl.Sink[_, _]]) ::
       (classOf[pekko.stream.scaladsl.Flow[_, _, _]],       
classOf[pekko.stream.javadsl.Flow[_, _, _]]) ::
diff --git 
a/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
 
b/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index a4007bd8de..dc9a61a29e 100644
--- 
a/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++ 
b/stream/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -202,3 +202,4 @@ 
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.Acto
 
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.ActorMaterializer.this")
 
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.impl.SetupStage")
 
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.impl.SetupStage$")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.javadsl.Source.future")
diff --git a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala 
b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
index cd045591a5..fe5b1f5ef0 100755
--- a/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/javadsl/Source.scala
@@ -20,7 +20,7 @@ import java.util.concurrent.{ CompletableFuture, 
CompletionStage }
 import scala.annotation.{ nowarn, varargs }
 import scala.annotation.unchecked.uncheckedVariance
 import scala.collection.immutable
-import scala.concurrent.{ Future, Promise }
+import scala.concurrent.Promise
 import scala.concurrent.ExecutionContext
 import scala.jdk.CollectionConverters._
 import scala.jdk.DurationConverters._
@@ -316,16 +316,6 @@ object Source {
   def failed[T](cause: Throwable): Source[T, NotUsed] =
     new Source(scaladsl.Source.failed(cause))
 
-  /**
-   * Emits a single value when the given Scala `Future` is successfully 
completed and then completes the stream.
-   * The stream fails if the `Future` is completed with a failure.
-   *
-   * Here for Java interoperability, the normal use from Java should be 
[[Source.completionStage]]
-   */
-  @deprecated("Use 'Source.completionStage' or 'scaladsl.Source.future' 
instead", "1.5.0")
-  def future[T](futureElement: Future[T]): Source[T, NotUsed] =
-    scaladsl.Source.future(futureElement).asJava
-
   /**
    * Never emits any elements, never completes and never fails.
    * This stream could be useful in tests.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to