Skip to content

Commit

Permalink
bump: scala-library 2.13.13 (was 2.13.12) (#810)
Browse files Browse the repository at this point in the history
* Fixed compilation errors (and cleaned up most warnings)
* H2 test fix
* skip Xsource3

---------

Co-authored-by: Johan Andrén <[email protected]>
  • Loading branch information
scala-steward and johanandren authored Mar 21, 2024
1 parent c3cebf5 commit faf4368
Show file tree
Hide file tree
Showing 28 changed files with 83 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class JdbcAsyncWriteJournal(config: Config) extends AsyncWriteJournal {
override def asyncReadHighestSequenceNr(persistenceId: String, fromSequenceNr: Long): Future[Long] = {
def fetchHighestSeqNr() = journalDao.highestSequenceNr(persistenceId, fromSequenceNr)
writeInProgress.get(persistenceId) match {
case null => fetchHighestSeqNr()
case f =>
case null => fetchHighestSeqNr()
case f: Future[Any @unchecked] =>
// we must fetch the highest sequence number after the previous write has completed
// If the previous write failed then we can ignore this
f.recover { case _ => () }.flatMap(_ => fetchHighestSeqNr())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ trait JournalTables {
eventSerManifest,
metaPayload,
metaSerId,
metaSerManifest) <> ((JournalAkkaSerializationRow.apply _).tupled, JournalAkkaSerializationRow.unapply)
metaSerManifest).<>((JournalAkkaSerializationRow.apply _).tupled, JournalAkkaSerializationRow.unapply)

val ordering: Rep[Long] = column[Long](journalTableCfg.columnNames.ordering, O.AutoInc)
val persistenceId: Rep[String] =
Expand All @@ -91,7 +91,7 @@ trait JournalTables {
lazy val JournalTable = new TableQuery(tag => new JournalEvents(tag))

class EventTags(_tableTag: Tag) extends Table[TagRow](_tableTag, tagTableCfg.schemaName, tagTableCfg.tableName) {
override def * = (eventId, persistenceId, sequenceNumber, tag) <> ((TagRow.apply _).tupled, TagRow.unapply)
override def * = (eventId, persistenceId, sequenceNumber, tag).<>((TagRow.apply _).tupled, TagRow.unapply)
// allow null value insert.
val eventId: Rep[Option[Long]] = column[Option[Long]](tagTableCfg.columnNames.eventId)
val persistenceId: Rep[Option[String]] = column[Option[String]](tagTableCfg.columnNames.persistenceId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory
import slick.jdbc.JdbcBackend.Database
import slick.jdbc.JdbcProfile

import scala.annotation.nowarn
import scala.collection.immutable.{ Nil, Seq }
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success, Try }
Expand Down Expand Up @@ -45,6 +46,7 @@ trait BaseByteArrayJournalDao
val queries: JournalQueries
val journalConfig: JournalConfig
override def baseDaoConfig: BaseDaoConfig = journalConfig.daoConfig
@nowarn("msg=deprecated")
val serializer: FlowPersistentReprSerializer[JournalRow]
implicit val ec: ExecutionContext
implicit val mat: Materializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import akka.persistence.PersistentRepr
import akka.persistence.jdbc.serialization.FlowPersistentReprSerializer
import akka.serialization.Serialization

import scala.annotation.nowarn
import scala.collection.immutable._
import scala.util.Try

@nowarn("msg=deprecated")
class ByteArrayJournalSerializer(serialization: Serialization, separator: String)
extends FlowPersistentReprSerializer[JournalRow] {
override def serialize(persistentRepr: PersistentRepr, tags: Set[String]): Try[JournalRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ trait JournalTables {
_tableTag,
_schemaName = journalTableCfg.schemaName,
_tableName = journalTableCfg.tableName) {
def * = (
ordering,
deleted,
persistenceId,
sequenceNumber,
message,
tags) <> ((JournalRow.apply _).tupled, JournalRow.unapply)
def * = (ordering, deleted, persistenceId, sequenceNumber, message, tags)
.<>((JournalRow.apply _).tupled, JournalRow.unapply)

val ordering: Rep[Long] = column[Long](journalTableCfg.columnNames.ordering, O.AutoInc)
val persistenceId: Rep[String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

package akka.persistence.jdbc.journal.dao

import scala.collection.immutable.Set

package object legacy {

final case class JournalRow(
ordering: Long,
deleted: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import akka.stream.scaladsl.{ Flow, Source }
import slick.jdbc.JdbcBackend._
import slick.jdbc.{ GetResult, JdbcProfile }

import scala.annotation.nowarn
import scala.collection.immutable._
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success, Try }
Expand All @@ -27,6 +28,7 @@ trait BaseByteArrayReadJournalDao extends ReadJournalDao with BaseJournalDaoWith
def db: Database
val profile: JdbcProfile
def queries: ReadJournalQueries
@nowarn("msg=deprecated")
def serializer: FlowPersistentReprSerializer[JournalRow]
def readJournalConfig: ReadJournalConfig

Expand Down Expand Up @@ -87,6 +89,7 @@ trait OracleReadJournalDao extends ReadJournalDao {
val profile: JdbcProfile
val readJournalConfig: ReadJournalConfig
val queries: ReadJournalQueries
@nowarn("msg=deprecated")
val serializer: FlowPersistentReprSerializer[JournalRow]

import readJournalConfig.journalTableConfiguration._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class JdbcSnapshotStore(config: Config) extends SnapshotStore {
snapshotDao.snapshotForMaxSequenceNr(persistenceId, maxSequenceNr)
case SnapshotSelectionCriteria(maxSequenceNr, maxTimestamp, _, _) =>
snapshotDao.snapshotForMaxSequenceNrAndMaxTimestamp(persistenceId, maxSequenceNr, maxTimestamp)
case _ => Future.successful(None)
case null => Future.successful(None)
}

result.map(_.map(toSelectedSnapshot))
Expand All @@ -91,7 +91,7 @@ class JdbcSnapshotStore(config: Config) extends SnapshotStore {
snapshotDao.deleteUpToMaxSequenceNr(persistenceId, maxSequenceNr)
case SnapshotSelectionCriteria(maxSequenceNr, maxTimestamp, _, _) =>
snapshotDao.deleteUpToMaxSequenceNrAndMaxTimestamp(persistenceId, maxSequenceNr, maxTimestamp)
case _ => Future.successful(())
case null => Future.successful(())
}

override def postStop(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait SnapshotTables {
snapshotPayload,
metaSerId,
metaSerManifest,
metaPayload) <> ((SnapshotRow.apply _).tupled, SnapshotRow.unapply)
metaPayload).<>((SnapshotRow.apply _).tupled, SnapshotRow.unapply)

val persistenceId: Rep[String] =
column[String](snapshotTableCfg.columnNames.persistenceId, O.Length(255, varying = true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait SnapshotTables {
_tableTag,
_schemaName = snapshotTableCfg.schemaName,
_tableName = snapshotTableCfg.tableName) {
def * = (persistenceId, sequenceNumber, created, snapshot) <> ((SnapshotRow.apply _).tupled, SnapshotRow.unapply)
def * = (persistenceId, sequenceNumber, created, snapshot).<>((SnapshotRow.apply _).tupled, SnapshotRow.unapply)

val persistenceId: Rep[String] =
column[String](snapshotTableCfg.columnNames.persistenceId, O.Length(255, varying = true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ package akka.persistence.jdbc.state.javadsl

import java.util.Optional
import java.util.concurrent.CompletionStage

import scala.compat.java8.FutureConverters._
import scala.concurrent.ExecutionContext

import akka.annotation.ApiMayChange
import slick.jdbc.JdbcProfile
import akka.{ Done, NotUsed }
Expand All @@ -22,6 +20,8 @@ import akka.persistence.query.{ DurableStateChange, Offset }
import akka.persistence.query.javadsl.DurableStateStoreQuery
import akka.stream.javadsl.Source

import scala.annotation.nowarn

object JdbcDurableStateStore {
val Identifier = ScalaJdbcDurableStateStore.Identifier
}
Expand Down Expand Up @@ -52,6 +52,7 @@ class JdbcDurableStateStore[A](
override def deleteObject(persistenceId: String): CompletionStage[Done] =
deleteObject(persistenceId, revision = 0)

@nowarn("msg=deprecated")
override def deleteObject(persistenceId: String, revision: Long): CompletionStage[Done] =
toJava(scalaStore.deleteObject(persistenceId))

Expand Down
6 changes: 5 additions & 1 deletion core/src/main/scala/akka/persistence/jdbc/util/TrySeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@

package akka.persistence.jdbc.util

import scala.annotation.nowarn
import scala.collection.immutable._
import scala.util.{ Failure, Success, Try }

object TrySeq {
def sequence[A](seq: Seq[Try[A]]): Try[Seq[A]] = {
def recurse(remaining: Seq[Try[A]], processed: Seq[A]): Try[Seq[A]] =
@nowarn("msg=exhaustive")
def recurse(remaining: Seq[Try[A]], processed: Seq[A]): Try[Seq[A]] = {
remaining match {
case Seq() => Success(processed)
case Success(head) +: tail => recurse(remaining = tail, processed :+ head)
case Failure(t) +: _ => Failure(t)
}
}

recurse(seq, Vector.empty)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ package akka.persistence.jdbc
import akka.{ Done, NotUsed }
import akka.actor.ActorSystem

import scala.annotation.nowarn
import scala.concurrent.Future

@nowarn("msg=never used")
object ScaladslSnippets {

def create(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import com.typesafe.config.ConfigFactory
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

import scala.annotation.nowarn

abstract class TablesTestSpec extends AnyFlatSpec with Matchers {
def toColumnName[A](tableName: String)(columnName: String): String = s"$tableName.$columnName"

@nowarn("msg=possible missing interpolator")
val config = ConfigFactory
.parseString("""
|akka-persistence-jdbc.slick.db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import com.typesafe.config.{ Config, ConfigFactory }
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

import scala.annotation.nowarn
import scala.concurrent.duration._

class AkkaPersistenceConfigTest extends AnyFlatSpec with Matchers {
private val referenceConfig: Config = ConfigFactory.load("reference")

@nowarn("msg=possible missing interpolator")
val config: Config = ConfigFactory
.parseString("""
|akka-persistence-jdbc.slick.db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ abstract class CurrentEventsByPersistenceIdTest(config: String) extends QueryTes
val env3 = tp.expectNext(ExpectNextTimeout)
val ordering3 = env3.offset match {
case Sequence(value) => value
case _ => fail()
}

val env6 = tp.expectNext(ExpectNextTimeout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import akka.persistence.query.{ EventEnvelope, NoOffset, Sequence }
import scala.concurrent.duration._
import akka.pattern.ask
import akka.persistence.journal.{ EventSeq, ReadEventAdapter, Tagged, WriteEventAdapter }
import org.scalatest.Assertions.fail

object EventAdapterTest {
case class Event(value: String) {
Expand All @@ -30,6 +31,7 @@ object EventAdapterTest {
override def fromJournal(event: Any, manifest: String): EventSeq =
event match {
case e: EventAdapted => EventSeq.single(e.restored)
case _ => fail()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ abstract class EventsByPersistenceIdTest(config: String) extends QueryTestSpec(c
val env3 = tp.expectNext(ExpectNextTimeout)
val ordering3 = env3.offset match {
case Sequence(value) => value
case _ => fail()
}

actor2 ! withTags(4, "ordering")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class EventsByUnfrequentTagTest(config: String) extends QueryTestSpec(c
implicit system =>

val journalOps = new ScalaJdbcReadJournalOperations(system)
withTestActors(replyToMessages = true) { (actor1, actor2, actor3) =>
withTestActors(replyToMessages = true) { (actor1, _, _) =>
val often = "often"
val notOften = "not-often"
withClue("Persisting multiple tagged events") {
Expand All @@ -46,8 +46,8 @@ abstract class EventsByUnfrequentTagTest(config: String) extends QueryTestSpec(c
}
journalOps.withEventsByTag()(often, NoOffset) { tp =>
tp.request(Int.MaxValue)
(0 until 100).foreach { i =>
tp.expectNextPF { case EventEnvelope(Sequence(i), _, _, _) => }
(1 to 100).foreach { i =>
tp.expectNextPF { case EventEnvelope(Sequence(`i`), _, _, _) => }
}
tp.cancel()
tp.expectNoMessage(NoMsgTime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ abstract class JournalDaoStreamMessagesMemoryTest(configFile: String)

val lastInsert =
Source
.fromIterator(() => (1 to numberOfInsertBatches).toIterator)
.fromIterator(() => (1 to numberOfInsertBatches).iterator)
.mapAsync(1) { i =>
val end = i * eventsPerBatch
val start = end - (eventsPerBatch - 1)
Expand Down Expand Up @@ -117,7 +117,7 @@ abstract class JournalDaoStreamMessagesMemoryTest(configFile: String)
case Failure(exception) =>
log.error("Failure when reading messages.", exception)
}
.runWith(TestSink.probe)
.runWith(TestSink())

probe.request(10)
probe.within(20.seconds) {
Expand Down
Loading

0 comments on commit faf4368

Please sign in to comment.