chore: Remove japi.option method (#2193)
* chore: Remove japi.option method * .
This commit is contained in:
parent
e8f241dba6
commit
42c2b493cb
4 changed files with 5 additions and 21 deletions
|
|
@ -15,11 +15,9 @@ package org.apache.pekko.actor;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.apache.pekko.event.Logging;
|
||||
import org.apache.pekko.event.Logging.LoggerInitialized;
|
||||
import org.apache.pekko.japi.Pair;
|
||||
import org.apache.pekko.japi.Util;
|
||||
import org.apache.pekko.japi.function.Creator;
|
||||
import org.apache.pekko.japi.tuple.Tuple22;
|
||||
import org.apache.pekko.japi.tuple.Tuple4;
|
||||
|
|
@ -32,7 +30,6 @@ import org.apache.pekko.testkit.TestProbe;
|
|||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.scalatestplus.junit.JUnitSuite;
|
||||
import scala.Option;
|
||||
|
||||
public class JavaAPI extends JUnitSuite {
|
||||
|
||||
|
|
@ -149,15 +146,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;
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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]))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import scala.concurrent.Future
|
|||
|
||||
import org.apache.pekko
|
||||
import pekko.dispatch.ExecutionContexts
|
||||
import pekko.japi.Util._
|
||||
import pekko.persistence._
|
||||
import pekko.persistence.snapshot.{ SnapshotStore => SSnapshotStore }
|
||||
import pekko.util.ConstantFun.scalaAnyToUnit
|
||||
|
|
@ -30,8 +29,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue