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

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

commit d26aa8013391d43970d012e824262da579cd455f
Author: He-Pin <[email protected]>
AuthorDate: Fri Sep 12 01:46:03 2025 +0800

    chore: Remove japi.option method
---
 actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java    | 9 ---------
 .../2.0.x.backwards.excludes/remove-deprecated-methods.excludes  | 2 +-
 actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala         | 5 -----
 .../apache/pekko/persistence/snapshot/japi/SnapshotStore.scala   | 6 ++++--
 4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java 
b/actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java
index a4a02f67b4..59fccf00e0 100644
--- a/actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java
+++ b/actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java
@@ -149,15 +149,6 @@ public class JavaAPI extends JUnitSuite {
     Tuple22.create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 
18, 19, 20, 21, 22);
   }
 
-  @Test
-  public void mustBeAbleToCreateOptionFromOptional() {
-    Option<Object> empty = Util.option(Optional.ofNullable(null));
-    assertTrue(empty.isEmpty());
-
-    Option<String> full = Util.option(Optional.ofNullable("hello"));
-    assertTrue(full.isDefined());
-  }
-
   public static class ActorWithConstructorParams extends UntypedAbstractActor {
 
     private final String a;
diff --git 
a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
 
b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index 64ebbaa2d3..88e60c1057 100644
--- 
a/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++ 
b/actor/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -156,5 +156,5 @@ 
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.dispatch.Th
 
ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.event.LoggingBus.org$apache$pekko$event$LoggingBus$_setter_$org$apache$pekko$event$LoggingBus$$guard_=")
 
ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.event.LoggingBus.org$apache$pekko$event$LoggingBus$$guard")
 
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.util.ReentrantGuard")
-
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.japi.Util.option")
 
diff --git a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala 
b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
index 88c3351808..91c846a682 100644
--- a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
+++ b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
@@ -148,9 +148,4 @@ object Util {
    */
   def immutableIndexedSeq[T](iterable: java.lang.Iterable[T]): 
immutable.IndexedSeq[T] =
     immutableSeq(iterable).toVector
-
-  // TODO in case we decide to pull in scala-java8-compat methods below could 
be removed - https://github.com/akka/akka/issues/16247
-
-  def option[T](jOption: java.util.Optional[T]): scala.Option[T] =
-    scala.Option(jOption.orElse(null.asInstanceOf[T]))
 }
diff --git 
a/persistence/src/main/scala/org/apache/pekko/persistence/snapshot/japi/SnapshotStore.scala
 
b/persistence/src/main/scala/org/apache/pekko/persistence/snapshot/japi/SnapshotStore.scala
index e7ca3bda55..643e41615d 100644
--- 
a/persistence/src/main/scala/org/apache/pekko/persistence/snapshot/japi/SnapshotStore.scala
+++ 
b/persistence/src/main/scala/org/apache/pekko/persistence/snapshot/japi/SnapshotStore.scala
@@ -30,8 +30,10 @@ abstract class SnapshotStore extends SSnapshotStore with 
SnapshotStorePlugin {
 
   override final def loadAsync(
       persistenceId: String,
-      criteria: SnapshotSelectionCriteria): Future[Option[SelectedSnapshot]] =
-    doLoadAsync(persistenceId, 
criteria).asScala.map(option)(ExecutionContexts.parasitic)
+      criteria: SnapshotSelectionCriteria): Future[Option[SelectedSnapshot]] = 
{
+    import pekko.util.OptionConverters._
+    doLoadAsync(persistenceId, 
criteria).asScala.map(_.toScala)(ExecutionContexts.parasitic)
+  }
 
   override final def saveAsync(metadata: SnapshotMetadata, snapshot: Any): 
Future[Unit] =
     doSaveAsync(metadata, 
snapshot).asScala.map(scalaAnyToUnit)(ExecutionContexts.parasitic)


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

Reply via email to