Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ the bottom of this file. Restoration ships incrementally per feature area.
- `crossScalaVersions` removed — the build is single-axis Scala 3.8.2.
- Java CI matrix is Temurin 17 / 21 / 25 (matches upstream/scala-3 baseline).

### import syntax

- All `import X._` wildcard imports modernized to Scala 3 `import X.*` (top-level and method-scoped occurrences).
- All `import X.{Y => Z}` rename clauses converted to Scala 3 `import X.Y as Z` (or `import X.{Y as Z, ...}` for multi-selector forms).
- `import java.io.{ObjectInput => _, _}` exclude+wildcard pattern rewritten as `import java.io.{ObjectInput as _, *}`.
- Scaladoc `@example` blocks updated to use the new syntax to match emitted code.

### core

- Type parameter wildcards `K[_]` / `D[_]` / `C[_]` narrowed to `K[Any]` / `D[Any]` / `C[Any]` at a few derivation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.avsystem.commons

import com.avsystem.commons.ser.{IsoInstantBenchmarks, JsonBenchmarks}
import japgolly.scalajs.benchmark.gui.BenchmarkGUI
import org.scalajs.dom._
import org.scalajs.dom.*

object Main {
def main(args: Array[String]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package core

import org.openjdk.jmh.annotations._
import org.openjdk.jmh.annotations.*

import scala.annotation.tailrec

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package core

import org.openjdk.jmh.annotations._
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole

@Warmup(iterations = 5)
Expand All @@ -10,7 +10,7 @@ import org.openjdk.jmh.infra.Blackhole
@BenchmarkMode(Array(Mode.Throughput))
class LoopBenchmark {

import LoopBenchmark._
import LoopBenchmark.*

@Benchmark
def rangeForeachTest(blackhole: Blackhole): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.openjdk.jmh.annotations.{Benchmark, BenchmarkMode, Fork, Measurement,
@State(Scope.Thread)
class BsonCodecBenchmark {

import BsonCodecBenchmark._
import BsonCodecBenchmark.*

private val something = Toplevel(42, Nested(List(4, 8, 15, 16, 23, 42, 0), 131), "lol")
private val doc = somethingCodec.toDocument(something)
Expand Down Expand Up @@ -52,7 +52,7 @@ class BsonCodecBenchmark {

object BsonCodecBenchmark {

import BsonCodec._
import BsonCodec.*

val bsonDocumentCodec = new BsonDocumentCodec()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.avsystem.commons
package ser

import com.avsystem.commons.serialization._
import com.avsystem.commons.serialization.*
import com.avsystem.commons.serialization.json.{JsonBinaryFormat, JsonOptions, JsonStringInput, JsonStringOutput}
import org.openjdk.jmh.annotations._
import org.openjdk.jmh.annotations.*

@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 10, time = 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package serialization.nativejs

import com.avsystem.commons.serialization._
import com.avsystem.commons.serialization.*
import com.avsystem.commons.serialization.json.RawJson

import scala.scalajs.js
Expand Down Expand Up @@ -48,7 +48,7 @@ final class NativeJsonOutput(
new NativeJsonObjectOutput(valueConsumer, options)

override def writeBinary(binary: Array[Byte]): Unit = {
import js.JSConverters._
import js.JSConverters.*
valueConsumer(binary.toJSArray)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object NativeJsonInputOutputTest {
}

class NativeJsonInputOutputTest extends AnyFunSuite {
import NativeJsonInputOutputTest._
import NativeJsonInputOutputTest.*

case class BilateralTestCase(name: String, options: NativeFormatOptions, testStringRepr: Boolean = true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import monix.execution.Scheduler
import monix.reactive.Observable

import scala.concurrent.Await
import scala.concurrent.duration._
import scala.concurrent.duration.*

abstract class BlockingUtils {
def defaultTimeout: Duration = 60.seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ObservableBlockingIterator[T](
) extends CloseableIterator[T]
with Subscriber[T] {

import ObservableBlockingIterator._
import ObservableBlockingIterator.*

@volatile private[this] var last: Any = Empty
@volatile private[this] var ackPromise: Promise[Ack] = _
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.avsystem.commons
package jiop

import java.{util => ju}
import java.util as ju

trait JOptionalUtils {

import JOptionalUtils._
import JOptionalUtils.*

type JOptional[T] = ju.Optional[T]
type JOptionalDouble = ju.OptionalDouble
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package jiop

import java.{util => ju}
import java.util as ju

trait JStreamUtils {
type JBaseStream[T, S <: ju.stream.BaseStream[T, S]] = ju.stream.BaseStream[T, S]
Expand All @@ -11,7 +11,7 @@ trait JStreamUtils {
type JLongStream = ju.stream.LongStream
type JCollector[T, A, R] = ju.stream.Collector[T, A, R]

import JStreamUtils._
import JStreamUtils.*

implicit def jStream2AsScala[T](jStream: JStream[T]): JStream2AsScala[T] =
new JStream2AsScala(jStream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jiop

trait Java8CollectionUtils {

import Java8CollectionUtils._
import Java8CollectionUtils.*

implicit def jIteratorOps[A](it: JIterator[A]): jIteratorOps[A] = new jIteratorOps(it)
implicit def jIterableOps[A](it: JIterable[A]): jIterableOps[A] = new jIterableOps(it)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package jiop

import scala.annotation.unchecked.{uncheckedVariance => uV}
import scala.annotation.unchecked.uncheckedVariance as uV
import scala.collection.Factory

final class ScalaJStream[+A](private val jStream: JStream[A @uV]) extends AnyVal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks

import scala.concurrent.TimeoutException
import scala.concurrent.duration._
import scala.concurrent.duration.*

class JvmTaskExtensionsTest extends AnyFunSuite with Matchers with ScalaCheckDrivenPropertyChecks with ScalaFutures {

import com.avsystem.commons.concurrent.TaskExtensions._
import com.avsystem.commons.concurrent.TaskExtensions.*

private implicit val scheduler: Scheduler = Scheduler.global

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package concurrent
import monix.reactive.Observable
import org.scalatest.funsuite.AnyFunSuite

import scala.concurrent.duration._
import scala.concurrent.duration.*

class ObservableBlockingIteratorTest extends AnyFunSuite {
test("empty") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package jiop

import com.avsystem.commons.jiop.GuavaInterop._
import com.avsystem.commons.jiop.GuavaInterop.*
import com.google.common.util.concurrent.{MoreExecutors, SettableFuture}
import org.scalatest.funsuite.AnyFunSuite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package macros
import com.avsystem.commons.derivation.{AllowImplicitMacro, DeferredInstance}
import org.scalatest.funsuite.AnyFunSuite

import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.universe as ru

object TypeClassDerivationTest {

Expand Down Expand Up @@ -70,7 +70,7 @@ object TypeClassDerivationTest {

class TypeClassDerivationTest extends AnyFunSuite {

import TypeClassDerivationTest._
import TypeClassDerivationTest.*

test("unknown test") {
assert(materialize[Int] == UnknownTC(typeRepr[Int]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package serialization

// TODO[scala3-port]: JCodecTestBase — depends on commented serialization test data / stubbed materialize (M)
/*
import CodecTestData._
import CodecTestData.*

trait JCodecTestBase extends AbstractCodecTest {
val jTreeMap = stringMap(new JTreeMap[String, Int])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ object SharedExtensionsUtils extends SharedExtensions {
*
* @example
* {{{
* import javax.swing._
* import javax.swing.*
* // this entire expression returns the panel
* new JPanel().setup { p =>
* p.setEnabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package annotation
* into implementation so that they can be accessed both in compile time and in runtime.
*
* {{{
* import scala.annotation._
* import com.avsystem.commons.serialization._
* import scala.annotation.*
* import com.avsystem.commons.serialization.*
*
* class mongoId extends AnnotationAggregate {
* @name("_id") @outOfOrder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.avsystem.commons
package collection

import scala.collection.{immutable => sci, mutable => scm}
import scala.{collection => sc}
import scala.collection.{immutable as sci, mutable as scm}
import scala.collection as sc

/** Aliases for Scala collections which are both concise and leave no doubt about whether the collection type is
* immutable, mutable or the base type (read only).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package concurrent

import scala.concurrent.duration._
import scala.concurrent.duration.*

trait DurationPostfixConverters {
implicit def durationInt(int: Int): DurationInt = new DurationInt(int)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package concurrent

import scala.concurrent.duration._
import scala.concurrent.duration.*

/** A `RetryStrategy` is conceptually a lazy sequence of delays, possibly infinite.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package jiop

import java.{lang => jl, util => ju}
import java.{lang as jl, util as ju}
import scala.collection.Factory

trait JCollectionUtils extends JFactories {
Expand Down Expand Up @@ -213,7 +213,7 @@ trait JCollectionUtils extends JFactories {
}
}

import JCollectionUtils._
import JCollectionUtils.*

implicit def pairIterableOps[A, B](coll: IterableOnce[(A, B)]): pairIterableOps[A, B] = new pairIterableOps(coll)
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/com/avsystem/commons/meta/metadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class DefaultValue[T](dv: => T) {
@transparent
final case class ParamFlags(rawFlags: Int) extends AnyVal {

import ParamFlags._
import ParamFlags.*

def |(other: ParamFlags): ParamFlags = new ParamFlags(rawFlags | other.rawFlags)
def &(other: ParamFlags): ParamFlags = new ParamFlags(rawFlags & other.rawFlags)
Expand Down Expand Up @@ -120,7 +120,7 @@ object SymbolSource extends HasGenCodec[SymbolSource]
@transparent
final case class TypeFlags(rawFlags: Int) extends AnyVal {

import TypeFlags._
import TypeFlags.*

def |(other: TypeFlags): TypeFlags = new TypeFlags(rawFlags | other.rawFlags)
def &(other: TypeFlags): TypeFlags = new TypeFlags(rawFlags & other.rawFlags)
Expand Down Expand Up @@ -173,7 +173,7 @@ object TypeFlags extends HasGenCodec[TypeFlags] {
@transparent
final case class MethodFlags(rawFlags: Int) extends AnyVal {

import MethodFlags._
import MethodFlags.*

def |(other: MethodFlags): MethodFlags = new MethodFlags(rawFlags | other.rawFlags)
def &(other: MethodFlags): MethodFlags = new MethodFlags(rawFlags & other.rawFlags)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/com/avsystem/commons/misc/NOpt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object NOpt {
*/
final class NOpt[+A] private (private val rawValue: Any) extends AnyVal with OptBase[A] with Serializable {

import NOpt._
import NOpt.*

private def value: A = (if (rawValue.asInstanceOf[AnyRef] eq NullMarker) null else rawValue).asInstanceOf[A]

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/com/avsystem/commons/misc/OptArg.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object OptArg {
* methods).
*/
final class OptArg[+A] private (private val rawValue: Any) extends AnyVal with OptBase[A] with Serializable {
import OptArg._
import OptArg.*

private def value: A = rawValue.asInstanceOf[A]

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/com/avsystem/commons/misc/TypedMap.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.avsystem.commons.misc

import com.avsystem.commons.SharedExtensions._
import com.avsystem.commons.SharedExtensions.*
import com.avsystem.commons.misc.TypedMap.GenCodecMapping
import com.avsystem.commons.serialization._
import com.avsystem.commons.serialization.*

/** A map whose keys are parameterized with value type. This makes it possible to associate different value type with
* each key, in a type-safe way.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package rpc

import com.avsystem.commons.meta._
import com.avsystem.commons.meta.*
import com.avsystem.commons.serialization.GenCodec

trait RPCFramework {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package rpc

import com.avsystem.commons.meta._
import com.avsystem.commons.meta.*

/** Mix in this trait into your RPC framework to support remote procedures, i.e. fire-and-forget methods with `Unit`
* return type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.avsystem.commons
package rpc

import com.avsystem.commons.meta._
import com.avsystem.commons.meta.*

/** You can use this annotation on overloaded RPC methods to give them unique identifiers for RPC serialization. You can
* also subclass this annotation provided that you always override the `name` parameter with another constructor
Expand Down Expand Up @@ -108,10 +108,10 @@ sealed trait RpcEncoding extends RawMethodAnnotation with RawParamAnnotation
* `AsReal` and `AsRaw`).
*
* {{{
* import com.avsystem.commons._
* import com.avsystem.commons.rpc._
* import com.avsystem.commons.serialization._
* import com.avsystem.commons.serialization.json._
* import com.avsystem.commons.*
* import com.avsystem.commons.rpc.*
* import com.avsystem.commons.serialization.*
* import com.avsystem.commons.serialization.json.*
*
* case class Json(jsonStr: String)
* object Json {
Expand Down
Loading
Loading