You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2025/09/11 18:55:09 UTC
(pekko) branch 1.2.x updated: chore: Deprecated japi.option (#2194)
This is an automated email from the ASF dual-hosted git repository.
hepin pushed a commit to branch 1.2.x
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/1.2.x by this push:
new 0fae0e1fd4 chore: Deprecated japi.option (#2194)
0fae0e1fd4 is described below
commit 0fae0e1fd4096f9188970562cd9edeb04ff9738a
Author: He-Pin(kerr) <he...@gmail.com>
AuthorDate: Fri Sep 12 02:55:04 2025 +0800
chore: Deprecated japi.option (#2194)
* chore: Deprecated japi.option
* .
* Update actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
Co-authored-by: PJ Fanning <pj...@users.noreply.github.com>
---------
Co-authored-by: PJ Fanning <pj...@users.noreply.github.com>
---
actor-tests/src/test/java/org/apache/pekko/actor/JavaAPI.java | 1 +
actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala | 1 +
.../org/apache/pekko/persistence/snapshot/japi/SnapshotStore.scala | 7 ++++---
3 files changed, 6 insertions(+), 3 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 253f0e4ffb..b903c9e44a 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
@@ -151,6 +151,7 @@ public class JavaAPI extends JUnitSuite {
}
@Test
+ @SuppressWarnings("deprecation")
public void mustBeAbleToCreateOptionFromOptional() {
Option<Object> empty = Util.option(Optional.ofNullable(null));
assertTrue(empty.isEmpty());
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 85fd954a19..65fa6757a7 100644
--- a/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
+++ b/actor/src/main/scala/org/apache/pekko/japi/JavaAPI.scala
@@ -305,6 +305,7 @@ object Util {
// TODO in case we decide to pull in scala-java8-compat methods below could be removed - https://github.com/akka/akka/issues/16247
+ @deprecated("This method will be removed in Pekko 2.0.0", "1.2.1")
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 ca7f1e9d9f..165c659feb 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
@@ -16,7 +16,6 @@ package org.apache.pekko.persistence.snapshot.japi
import scala.concurrent.Future
import org.apache.pekko
-import pekko.japi.Util._
import pekko.persistence._
import pekko.persistence.snapshot.{ SnapshotStore => SSnapshotStore }
@@ -28,8 +27,10 @@ abstract class SnapshotStore extends SSnapshotStore with SnapshotStorePlugin {
override final def loadAsync(
persistenceId: String,
- criteria: SnapshotSelectionCriteria): Future[Option[SelectedSnapshot]] =
- doLoadAsync(persistenceId, criteria).map(option)
+ criteria: SnapshotSelectionCriteria): Future[Option[SelectedSnapshot]] = {
+ import pekko.util.OptionConverters._
+ doLoadAsync(persistenceId, criteria).map(_.toScala)
+ }
override final def saveAsync(metadata: SnapshotMetadata, snapshot: Any): Future[Unit] =
doSaveAsync(metadata, snapshot).map(_ => ())
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org