Skip to content

fix: Scala 3.9 compatibility fixes#1074

Merged
He-Pin merged 4 commits into
apache:mainfrom
He-Pin:fix/scala-3.9-compat
Jun 19, 2026
Merged

fix: Scala 3.9 compatibility fixes#1074
He-Pin merged 4 commits into
apache:mainfrom
He-Pin:fix/scala-3.9-compat

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 18, 2026

Copy link
Copy Markdown
Member

Motivation

Scala 3.9.0-RC1 introduces several breaking changes:

  1. -language:_ wildcard option is no longer accepted
  2. -Yfuture-lazy-vals option removed (behavior is now default)
  3. -Ywarn-dead-code is Scala 2 only
  4. Context bound desugaring changes, breaking explicit ClassTag/Tuple/LogSource passing patterns

Modification

  • build.sbt: Make -language:_ conditional on Scala 3 minor < 9
  • project/Common.scala: Move -Ywarn-dead-code to Scala 2 only, conditionally include -Yfuture-lazy-vals for Scala 3 < 3.9
  • HttpMessage.scala, RejectionHandler.scala, PredefinedToResponseMarshallers.scala: Use implicit val ClassTag instead of context bound [T: ClassTag]
  • Directive.scala, BasicDirectives.scala, PathMatcher.scala: Use implicit val Tuple instead of context bound [L: Tuple]
  • PoolInterface.scala, StageLoggingWithOverride.scala: Use implicit val LogSource instead of explicit passing

Result

pekko-http parsing, http-core, http, and http-testkit modules compile cleanly with Scala 3.9.0-RC1.

Tests

  • sbt "++3.9.0-RC1!; parsing/compile; http-core/compile; http/compile; http-testkit/compile" passes

References

None - Scala 3.9 forward compatibility

He-Pin added 2 commits June 16, 2026 12:03
Motivation:
sbt lint reported 45 unused keys across sub-projects.

Modification:
Add projectInfoVersion, mimaReportSignatureProblems, autoAPIMappings,
and unidocProjectFilter to excludeLintKeys in project/Common.scala
globalSettings.

Result:
sbt lint warnings resolved.

Tests:
- sbt "http-core / compile; http / compile; parsing / compile" - sbt lint warnings resolved
- sbt "http-caching / compile; http-cors / compile; http-testkit / compile" - sbt lint warnings resolved

References:
None - build configuration cleanup
Motivation:
Scala 3.9.0-RC1 introduces several breaking changes:
1. -language:_ wildcard option is no longer accepted
2. -Yfuture-lazy-vals option removed (now default behavior)
3. -Ywarn-dead-code is Scala 2 only
4. Context bound desugaring changes, breaking explicit ClassTag/Tuple/
   LogSource passing patterns

Modification:
- build.sbt: make -language:_ conditional on Scala 3 < 3.9
- project/Common.scala: move -Ywarn-dead-code to Scala 2 only,
  conditionally include -Yfuture-lazy-vals for Scala 3 < 3.9
- HttpMessage.scala, RejectionHandler.scala, PredefinedToResponseMarshallers.scala:
  use implicit val ClassTag instead of context bound [T: ClassTag]
- Directive.scala, BasicDirectives.scala, PathMatcher.scala:
  use implicit val Tuple instead of context bound [L: Tuple]
- PoolInterface.scala, StageLoggingWithOverride.scala:
  use implicit val LogSource instead of explicit passing

Result:
pekko-http parsing, http-core, http, and http-testkit modules compile
cleanly with Scala 3.9.0-RC1.

Tests:
- sbt "++3.9.0-RC1!; parsing/compile; http-core/compile; http/compile;
  http-testkit/compile" passes

References: None - Scala 3.9 forward compatibility
@He-Pin He-Pin requested a review from pjfanning June 19, 2026 05:11
Comment thread build.sbt Outdated
Motivation:
The same scalacOptions block for `-language:_` (excluded on Scala 3.9+)
was repeated inline in 3 places in build.sbt.

Modification:
Add `Common.notOnScala39Plus` helper and replace all 3 inline blocks.

Result:
Single source of truth for the Scala 3.9+ language option exclusion.

Tests:
Not run - build config only

References:
Refs apache#1074

@He-Pin He-Pin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Extracted notOnScala39Plus helper in Common.scala and replaced all 3 inline blocks.

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Motivation:
The previous commit used unqualified `notOnScala39Plus` which is not
in scope in build.sbt, causing compilation failure.

Modification:
Prefix all 3 call sites with `Common.` and run scalafmt.

Result:
build.sbt compiles successfully with the shared helper.

Tests:
Not run - build config fix

References:
Refs apache#1074
@He-Pin He-Pin merged commit 4784d0b into apache:main Jun 19, 2026
5 checks passed
@He-Pin He-Pin deleted the fix/scala-3.9-compat branch June 19, 2026 09:22
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.

2 participants