Skip to content

Migrate to Scala 3.9.0 LTS - #5574

Open
pierscin wants to merge 1 commit into
masterfrom
scala-3-9-migration
Open

pierscin wants to merge 1 commit into
masterfrom
scala-3-9-migration

Conversation

@pierscin

@pierscin pierscin commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Needs scala 3.9+ - probably needs new minor version

I think the biggest gotcha is that openapiCodegenCore is compiled with sbt 2.0.x so it needs scala 3.8. sbt 2.1.x will use scala 3.9

Build:
- Scala 3.3.8 -> 3.9.0; javaOutputVersion 17 for Scala 3 (required since 3.8),
  11 for Scala 2; drop -Yfuture-lazy-vals (3.3-only, the default since 3.8)
- -Xsource:3 for Scala 2.12/2.13, so that the shared sources can use Scala 3
  syntax; on 2.13, scala3-migration issues (copy/apply access of case classes
  with non-public constructors) are reported as warnings
- scalafmt: allow postfix `*` vararg splices
- openapi-codegen sbt plugin: sbt 2.0.x runs on Scala 3.8 and can't load code
  depending on the Scala 3.9 build of openapiCodegenCore, so the plugin is built
  directly from the codegen-core sources
- codegen-core tests: add scala3-repl (a separate artifact since Scala 3.8)
- Scala Steward: pin scala3-* to 3.9.x; remove the zio-json and
  zio-opentelemetry pins (only needed because they are built with Scala 3.9)
- CI: SCALA_3_NEXT 3.8.3 -> 3.10.0

Sources (fixing the new warnings instead of suppressing them):
- `_` -> `?` type wildcards, `A with B` -> `A & B`, `xs: _*` -> `xs*`
- explicit arguments to implicit parameters passed with `using`
- `var x: T = _` -> `= null` (`uninitialized` in Scala 3-only modules),
  `private[this]` -> `private`
- `f _` -> eta-expansion / explicit lambdas
- `$ref` fields and non-infix methods used as operators in backticks
- explicit types of implicit vals and overrides (required with -Xsource:3)
- explicit type arguments for `CustomiseInterceptors(...)` in server options
  and `Files.get` (scalac 2.12 with -Xsource:3 overflows the stack / fails to
  infer them otherwise)
- pekko-http: read the remote address from the request's attributes map, as
  `HttpRequest.attribute` needs an implicit private to pekko-http
- remove unused imports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pierscin
pierscin force-pushed the scala-3-9-migration branch from 6381da2 to 965d592 Compare October 12, 2026 12:15
@pierscin
pierscin marked this pull request as ready for review October 12, 2026 13:07
@pierscin
pierscin requested a review from adamw October 12, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant