Skip to content

♻️ refactor: remove Compat methods in favour on their implementation#721

Merged
gaeljw merged 4 commits into
mainfrom
chore/remove-compat-methods
Jun 15, 2026
Merged

♻️ refactor: remove Compat methods in favour on their implementation#721
gaeljw merged 4 commits into
mainfrom
chore/remove-compat-methods

Conversation

@gaeljw

@gaeljw gaeljw commented Jun 14, 2026

Copy link
Copy Markdown
Member

Pull Request Checklist

Purpose

Clean code.

Background Context

This code was different when we were cross building to Scala 2.11/2.12 but not required anymore.

gaeljw added 2 commits June 14, 2026 17:15
…directly

This code was different when we were cross building to Scala 2.11/2.12 but not required anymore
@gaeljw gaeljw requested review from cchantep, Copilot and mkurz June 14, 2026 15:25
Comment thread build.sbt

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the internal anorm.Compat helper layer and rewrites call sites to use standard library APIs directly (e.g., right-biased Either, lazyZip, collection conversions), reflecting the project’s current Scala 2.13/3 baseline.

Changes:

  • Replaced Compat collection/type aliases (Trav, LazyLst) with Iterable/LazyList and inlined helper methods (rightMap, rightFlatMap, toMap, etc.).
  • Updated parsing/mapping code paths to use direct Either and collection operations.
  • Removed core/src/main/scala/anorm/Compat.scala and added MiMa filters for the missing Compat classes.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
core/src/main/scala/anorm/ToStatementMisc.scala Switch stream/traversable handling from Compat.* aliases to LazyList/Iterable.
core/src/main/scala/anorm/ToSql.scala Same refactor for SQL fragment generation over streams/iterables.
core/src/main/scala/anorm/TopLevelDefinitions.scala Replace Compat Java-enum iterator helper with scala.jdk.CollectionConverters usage.
core/src/main/scala/anorm/SqlParser.scala Inline Either right-bias operations (remove Compat.rightFlatMap).
core/src/main/scala/anorm/Row.scala Replace Compat.lazyZip/toMap helpers with direct lazyZip and .to(Map).
core/src/main/scala/anorm/MetaData.scala Replace Compat.toMap/toFlatMap with view + .to(Map) equivalents.
core/src/main/scala/anorm/Cursor.scala Replace Compat.lazyZip usage with direct lazyZip.
core/src/main/scala/anorm/Compat.scala Removed the Compat object entirely.
core/src/main/scala/anorm/Column.scala Inline Either.map/flatMap where Compat.rightMap/rightFlatMap was used.
core/src/main/scala/anorm/BatchSql.scala Replace Compat.Trav with Iterable in public/internal APIs.
core/src/main/scala-3/anorm/macros/ToParameterListImpl.scala Remove unused Compat import after refactor.
core/src/main/scala-3/anorm/macros/Inspect.scala Remove unused Compat import after refactor.
core/src/main/scala-2/anorm/macros/ToParameterListImpl.scala Replace Compat helpers with view.mapValues, view.collect, .to(Map).
core/src/main/scala-2/anorm/macros/Inspect.scala Replace Compat.Trav with Iterable and direct lazyZip.
build.sbt Add MiMa excludes for removed anorm.Compat classes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/scala/anorm/Row.scala Outdated
Comment thread core/src/main/scala/anorm/Row.scala Outdated
Comment thread core/src/main/scala-2/anorm/macros/Inspect.scala Outdated
mkurz added 2 commits June 14, 2026 23:37
Use direct two-argument lambdas for lazyZip mappings so the code matches the LazyZip API more clearly.

Avoid allocating temporary single-entry maps when building aliased metadata dictionaries.
@gaeljw gaeljw merged commit c12cc3b into main Jun 15, 2026
12 checks passed
@gaeljw gaeljw deleted the chore/remove-compat-methods branch June 15, 2026 05:20
@gaeljw gaeljw added this to the 3.2.x milestone Jun 22, 2026
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.

3 participants