Skip to content

fix: replace private[this] with private and =_ with explicit defaults#1068

Merged
He-Pin merged 1 commit into
apache:mainfrom
He-Pin:scala3-deprecation-fixes
Jun 15, 2026
Merged

fix: replace private[this] with private and =_ with explicit defaults#1068
He-Pin merged 1 commit into
apache:mainfrom
He-Pin:scala3-deprecation-fixes

Conversation

@He-Pin

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

Copy link
Copy Markdown
Member

Summary

  • Replace private[this] with private across ~40 files (Scala 3 deprecation: private[this] is subsumed by private)
  • Replace = _ with explicit defaults (= null, = 0L, etc.) across ~15 files (Scala 3 deprecation)
  • Fix refutable pattern in HttpHeaderParserSpec (val type annotation → asInstanceOf)

Details

These are purely mechanical changes to address Scala 3 deprecation warnings. No behavioral changes.

private[this]private

Affects benchmarks, core engine classes, parsers, model classes, testkit, and test code.

= _ → explicit defaults

Replaces uninitialized var declarations with explicit defaults (= null for reference types, = 0L for longs, etc.).

Test fix

HttpHeaderParserSpec: refutable pattern in val definition (type annotation) replaced with asInstanceOf.

Test plan

  • sbt "++ 2.13 Test/compile" passes
  • sbt "++ 3.3 Test/compile" passes
  • No behavioral changes — purely mechanical refactoring

Motivation

Scala 3 deprecates private[this] and = _ syntax. These changes ensure forward compatibility.

Modification

Mechanical replacement of deprecated syntax across ~50 files.

Result

All modules compile cleanly on both Scala 2.13.18 and 3.3.8 with no deprecation warnings for these patterns.

Tests

  • sbt "++ 2.13 Test/compile" passes
  • sbt "++ 3.3 Test/compile" passes

References

None - Scala 3 forward compatibility

Motivation:
Scala 3 deprecates `private[this]` (subsumed by `private`) and `= _`
initializer syntax. These produce warnings that become errors under
-Werror.

Modification:
- Replace `private[this]` with `private` across ~40 files
- Replace `= _` with explicit defaults (`= null`, `= 0L`, etc.) across
  ~15 files
- Fix refutable pattern in HttpHeaderParserSpec (val type annotation
  to asInstanceOf)

Result:
All modules compile cleanly on both Scala 2.13.18 and 3.3.8 with no
deprecation warnings for these patterns.

Tests:
- sbt "++ 2.13 Test/compile" passes
- sbt "++ 3.3 Test/compile" passes

References:
None - Scala 3 forward compatibility

@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

@He-Pin He-Pin merged commit 23ffde9 into apache:main Jun 15, 2026
5 checks passed
@He-Pin He-Pin deleted the scala3-deprecation-fixes branch June 15, 2026 16:05
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