This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-management.git
The following commit(s) were added to refs/heads/main by this push:
new 2ed844c5 chore: Rewrite to scala3 syntax (#826)
2ed844c5 is described below
commit 2ed844c51933cc61f0cbb78ea77e10913d65e131
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jun 14 20:43:17 2026 +0800
chore: Rewrite to scala3 syntax (#826)
Motivation:
Let Scala 3 Community build compile pekko-management.
Modification:
Update .scalafmt.conf dialect to scala213source3 and enable
scala3 syntax rewrite rules, then reformat all sources.
Result:
Wildcard types use ? syntax (e.g. Class[?] instead of Class[_]).
Tests:
Not run - formatting only
References:
Refs apache/pekko#3048
---
.scalafmt.conf | 12 +++++++++++-
.../ClusterBootstrapDiscoveryBackoffIntegrationSpec.scala | 2 +-
.../cluster/scaladsl/ClusterHttpManagementRoutes.scala | 4 ++--
project/Common.scala | 2 +-
project/CopyrightHeader.scala | 6 +++---
5 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/.scalafmt.conf b/.scalafmt.conf
index 2f63f8c7..e3bb547a 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -1,5 +1,5 @@
version = 3.11.1
-runner.dialect = scala213
+runner.dialect = scala213source3
project.git = true
style = defaultWithAlign
docstrings.style = Asterisk
@@ -75,3 +75,13 @@ project.excludeFilters = [
"scripts/authors.scala"
]
project.layout = StandardConvention
+
+rewrite.scala3.convertToNewSyntax = true
+runner {
+ dialectOverride {
+ allowSignificantIndentation = false
+ allowAsForImportRename = false
+ allowStarWildcardImport = false
+ allowPostfixStarVarargSplices = false
+ }
+}
diff --git
a/management-cluster-bootstrap/src/test/scala/org/apache/pekko/management/cluster/bootstrap/contactpoint/ClusterBootstrapDiscoveryBackoffIntegrationSpec.scala
b/management-cluster-bootstrap/src/test/scala/org/apache/pekko/management/cluster/bootstrap/contactpoint/ClusterBootstrapDiscoveryBackoffIntegrationSpec.scala
index 2dd113c5..16f1218b 100644
---
a/management-cluster-bootstrap/src/test/scala/org/apache/pekko/management/cluster/bootstrap/contactpoint/ClusterBootstrapDiscoveryBackoffIntegrationSpec.scala
+++
b/management-cluster-bootstrap/src/test/scala/org/apache/pekko/management/cluster/bootstrap/contactpoint/ClusterBootstrapDiscoveryBackoffIntegrationSpec.scala
@@ -110,7 +110,7 @@ class ClusterBootstrapDiscoveryBackoffIntegrationSpec
extends AnyWordSpecLike wi
val bootstrapB = ClusterBootstrap(systemB)
val baseTime = System.currentTimeMillis()
- case class DiscoveryRequest(time: Long, attempt: Int, res: Future[_]) {
+ case class DiscoveryRequest(time: Long, attempt: Int, res: Future[?]) {
override def toString = s"DiscoveryRequest(${(time - baseTime).millis},
$attempt, $res)"
}
val resolveProbe = TestProbe()(systemA)
diff --git
a/management-cluster-http/src/main/scala/org/apache/pekko/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala
b/management-cluster-http/src/main/scala/org/apache/pekko/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala
index 4a339114..8b21eb7d 100644
---
a/management-cluster-http/src/main/scala/org/apache/pekko/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala
+++
b/management-cluster-http/src/main/scala/org/apache/pekko/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala
@@ -144,7 +144,7 @@ object ClusterHttpManagementRoutes extends
ClusterHttpManagementJsonProtocol {
import pekko.stream.scaladsl.Source
import scala.concurrent.{ ExecutionContext, Promise }
- val eventClasses: Map[String, Class[_]] = Map(
+ val eventClasses: Map[String, Class[?]] = Map(
"ClusterDomainEvent" -> classOf[ClusterEvent.ClusterDomainEvent],
"MemberEvent" -> classOf[ClusterEvent.MemberEvent],
"MemberJoined" -> classOf[ClusterEvent.MemberJoined],
@@ -171,7 +171,7 @@ object ClusterHttpManagementRoutes extends
ClusterHttpManagementJsonProtocol {
parameter("type".as[String].*) { providedEventTypes =>
val classes =
if (providedEventTypes.nonEmpty)
- providedEventTypes.foldLeft(List.empty[Class[_]]) {
+ providedEventTypes.foldLeft(List.empty[Class[?]]) {
case (accum, eventType) =>
eventClasses.get(eventType).toList ::: accum
}
diff --git a/project/Common.scala b/project/Common.scala
index a5cacbfe..c806dfbb 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -26,7 +26,7 @@ object Common extends AutoPlugin {
val isScala3 = Def.setting(scalaBinaryVersion.value == "3")
- override lazy val projectSettings: Seq[sbt.Def.Setting[_]] =
+ override lazy val projectSettings: Seq[sbt.Def.Setting[?]] =
Seq(
startYear := Some(2022),
homepage := Some(url("https://pekko.apache.org/")),
diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 1a592043..9af7372c 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -23,7 +23,7 @@ trait CopyrightHeader extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
- protected def headerMappingSettings: Seq[Def.Setting[_]] =
+ protected def headerMappingSettings: Seq[Def.Setting[?]] =
Seq(Compile, Test).flatMap { config =>
inConfig(config)(
Seq(
@@ -35,9 +35,9 @@ trait CopyrightHeader extends AutoPlugin {
HeaderFileType("template") -> cStyleComment)))
}
- override def projectSettings: Seq[Def.Setting[_]] =
Def.settings(headerMappingSettings, additional)
+ override def projectSettings: Seq[Def.Setting[?]] =
Def.settings(headerMappingSettings, additional)
- def additional: Seq[Def.Setting[_]] =
+ def additional: Seq[Def.Setting[?]] =
Def.settings(Compile / compile := {
(Compile / headerCreate).value
(Compile / compile).value
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]