Skip to content
CAI
Software that uses CAICheck a score

scala/scala-collection-compat

67.7

Adequate · 20 September 2026

7.2k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a compatibility library and migration toolset for Scala that enables codebases running on Scala 2.11 and 2.12 to utilize APIs and features introduced in Scala 2.13. It provides backported implementations of standard library components, such as collection operations, resource management utilities, and Java interop converters, ensuring binary and source compatibility across versions. Additionally, it includes Scalafix rules that automatically rewrite deprecated collection patterns and migration artifacts to align with modern Scala standards.

How it got here

2017–2018 — Rebranding and Scala 2.13 compatibility

27 changes.

The project was restructured and rebranded as scala-collection-compat, shifting focus to providing a compatibility layer for Scala 2.13 APIs on older versions alongside migration tools. This period involved backporting extensive Scala 2.13 collection features to Scala 2.11 and 2.12, updating build infrastructure for multi-platform support, and developing comprehensive Scalafix rules to automate code migration.

2019–2025 — Scala 2.11/2.12 compatibility backports

17 changes.

This period focused on backporting Scala 2.13 standard library features to the Scala 2.11 and 2.12 compatibility layer, including collection converters, OptionConverters, and resource management utilities. The work also involved adding stubs for newer annotations and ensuring API parity across JVM, Scala.js, and Scala Native platforms. Comprehensive test suites were added to verify the correctness of these backported features and their behavior across different environments.

Features

Add Scala 2.12 companion source for collection compatibility fixes

A new source file, CompanionSrc212.scala, has been added to the scalafix/output212 module to provide Scala 2.12-specific implementations for collection compatibility fixes. This file imports the scala-collection-compat library and defines an object that exercises iterableFactory access on various immutable and mutable collection types (such as Stack, DoubleLinkedList, LinkedList, MutableList, and ResizableArray), ensuring that the scalafix rules correctly handle these patterns in Scala 2.12 environments.

scalafix/output212 · high confidence

Added Java API collection forwarders for Scala 2.11 and 2.12

New \CollectionConverters\ objects have been added in the \scala.jdk.javaapi\ package for both Scala 2.11 and 2.12 compatibility layers. These objects provide explicit conversion methods (such as \asJava\ and \asScala\) between Scala and Java collections, specifically designed for use in Java code. The implementation delegates to the underlying Scala collection conversion traits (\WrapAsJava\/\WrapAsScala\ for 2.11 and \AsJavaConverters\/\AsScalaConverters\ for 2.12), ensuring that Java consumers can seamlessly interoperate with Scala collection types.

compat/src/main/scala-2.11/scala/jdk, compat/src/main/scala-2.12/scala/jdk · high confidence

Added Scala 2.13 migration rules for collection and tuple APIs

The scalafix tool now includes specific migration rules for Scala 2.13, covering the replacement of \\#::\ with \LazyList\ syntax, the use of \filterInPlace\ on mutable collections, the adoption of \LazyList\ constructors, and the transition from \zip\/\zipped\ to \lazyZip\ for tuples and collections. These rules help users update their codebases to align with the new collection library and syntax changes introduced in Scala 2.13.

scalafix/output213 · high confidence

Added slim OptionConverters for Scala.js and Scala Native

A new \OptionConverters\ object has been added to the \compat/jsNative\ module to provide extension methods for converting between Scala \Option\ and Java \Optional\. This implementation is tailored for Scala.js and Scala Native environments, offering \toJava\ and \toScala\ methods while intentionally excluding conversions for primitive \Optional\ wrappers (such as \OptionalInt\) that are not supported in these platforms. This ensures API compatibility with the standard library's JVM version without including unsupported features.

compat/jsNative · high confidence

Adds Scala 2.11 compatibility extensions for collection operations

This change introduces the Scala 2.11-specific compatibility package, providing implicit extension methods that bring modern collection behaviors to older Scala versions. Specifically, it enables chaining of \filterKeys\ after \mapValues\ by adding a \CanBuildFrom\ instance for \IterableView\ that preserves the strict \Map\ type, and it adds support for lazy zipped operations on tuples via \Tuple2Zipped\ extension methods. Additionally, it provides extension methods for \Seq\, \TraversableLike\, and both immutable and mutable \Queue\ types, along with a \CanBuildFrom\ instance for \GenericOrderedCompanion\ to support ordered collection builders.

compat/src/main/scala-2.11/scala/collection · high confidence

Adds Scala 2.12 collection compatibility extensions

This change introduces the Scala 2.12-specific compatibility package, providing implicit classes and conversions that bring newer collection features to Scala 2.12. Users gain access to extensions for mutable and immutable queues (such as \enqueueAll\), new methods for sorted maps and trees (\from\ factory methods), and utilities for lazy zipped tuples. The package also enables chaining of \filterKeys\ and \mapValues\ on map views and adds size-comparison methods (\sizeCompare\, \sizeIs\, \lengthIs\) via the shared compatibility layer.

compat/src/main/scala-2.12/scala/collection · high confidence

Automated code formatting via Scalafmt pre-commit hook

Developers can now automatically format Scala code using Scalafmt version 3.7.4 before committing changes. This is achieved through a new pre-commit hook installed via the admin scripts, which bootstraps the Scalafmt CLI tool and runs it in test mode to ensure code style compliance.

admin · high confidence

Backport Scala 2.13 OptionConverters to Scala 2.11 and 2.12

Users running Scala 2.11 or 2.12 on the JVM can now use the \scala.jdk.OptionConverters\ API to seamlessly convert between Scala \Option\ and Java \Optional\ types, including specialized variants like \OptionalInt\, \OptionalLong\, and \OptionalDouble\. This backport brings parity with Scala 2.13's standard library, allowing developers to use modern extension methods such as \toJava\, \toScala\, and \toJavaPrimitive\ for cleaner interop with Java libraries, while retaining deprecated aliases (\asJava\/\asScala\) for backward compatibility.

compat/jvm · high confidence

Backport Scala 2.13 collection compatibility API to Scala 2.11 and 2.12

This update introduces a comprehensive set of compatibility extensions for Scala 2.11 and 2.12, bringing many Scala 2.13 collection features to older versions. Key additions include the \BuildFrom\ type class for improved collection construction, \StringOps\ with safe parsing methods like \toIntOption\ and \toBooleanOption\, and \RandomExtensions\ providing \nextLong(n)\. The library also implements various collection operations such as \distinctBy\, \groupMap\, \groupMapReduce\, \partitionMap\, \sizeCompare\, \sizeIs\, \lengthIs\, \tapEach\, \filterKeys\, \mapValues\, \unfold\, \maxBefore\, \minAfter\, \minOption\, \maxOption\, \minByOption\, \maxByOption\, \nextOption\, \enqueueAll\, \updatedWith\, \foreachEntry\, and \lazyZip\. Additionally, it provides \Option.when\ and \Option.unless\, \Array.from\, and ensures binary compatibility for \Factory\ while preserving immutable collection types during conversions.

_compat/src/main/scala-2.11\2.12/scala/collection/compat · high confidence

Backport of scala.util.Using for Scala 2.12

The \scala.util.Using\ utility for automatic resource management, previously available only in Scala 2.13, is now provided for Scala 2.12 users. This change adds a compatibility layer that mirrors the 2.13.17 implementation, allowing developers to use \Using.apply\ for single resources and \Using.Manager\ for managing multiple resources with automatic release and exception suppression, ensuring consistent behavior across supported Scala versions.

compat/src/main/scala-2.11/scala/util, compat/src/main/scala-2.12/scala/util · high confidence

Backport scala.jdk.CollectionConverters to Scala 2.11 and 2.12

A new \CollectionConverters\ object has been added to the compatibility layer for Scala 2.11 and 2.12, providing the \DecorateAsJava\ and \DecorateAsScala\ traits. This allows users on these older Scala versions to use the standard Java-to-Scala and Scala-to-Java collection conversion methods available in newer Scala releases.

_compat/src/main/scala-2.11\2.12/scala/jdk · high confidence

Backports scala.util.chaining, ControlThrowable, and RegexOps to Scala 2.11/2.12

This change adds compatibility shims for Scala 2.11 and 2.12 to bring them in line with newer Scala standard library features. Users can now use the \scala.util.chaining\ package to chain operations with \tap\ and \pipe\ methods, access the \scala.util.control.compat.ControlThrowable\ class for efficient flow-control exceptions (with suppressed stack traces and suppression disabled), and utilize the \RegexOps\ implicit class on \Regex\ instances to call the \matches\ method directly. These additions ensure API parity and consistent behavior across Scala versions within this compatibility layer.

_compat/src/main/scala-2.11\2.12/scala/util · high confidence

New Scala 2.13 collection migration rules

The scalafix rules module now includes a new set of rules (Collection213CrossCompat, Collection213Upgrade, Collection213Experimental, Collection213Roughly) to assist in migrating Scala code to version 2.13. These rules handle common breaking changes, such as replacing deprecated \Traversable\ with \Iterable\, updating symbolic fold operators (\/:\ and \:\\\) to \foldLeft\ and \foldRight\, and rewriting \breakOut\ usage to modern collection builders. The implementation adds support for \immutable.SortedSet\ and \Vector\ in \breakOut\ contexts and fixes a regression with newer scalafix versions.

scalafix/rules · high confidence

Removals

Removed deprecated Collectionstrawman\_v0 rewrite rule

The \Collectionstrawman\_v0\ rewrite rule, which previously handled migration from \scala.collection.immutable.List\ to \strawman.collection.immutable.List\, has been removed from the rewrites module. This eliminates the automatic import patching for this specific legacy collection migration path.

rewrites · high confidence

Removed legacy Collection strawman input test case

The input file for the \Collectionstrawman\_v0\ migration test case has been removed. This deletion eliminates the sample code used to verify the rewriting behavior for the legacy Scala collection strawman API, indicating that this specific migration path is no longer supported or required in the current test suite.

input · high confidence

Removed strawman collection migration output file

The generated output file for the strawman collection migration (Collectionstrawman\_v0.scala) has been removed. This file previously contained code demonstrating the migration of scala.List to strawman.collection.immutable.List, but it is no longer part of the output.

output · high confidence

Behavioural changes

Added @nowarn annotation stub for Scala 2.11 compatibility

A stub implementation of the \@nowarn\ annotation has been added to the Scala 2.11 compatibility layer. This allows codebases using \@nowarn\ to cross-compile against Scala 2.11, where the annotation is natively unavailable (it was introduced in 2.12.13 and 2.13.2). While the annotation provides no actual warning suppression functionality on Scala 2.11, its presence prevents compilation errors for users relying on this feature in newer Scala versions.

compat/src/main/scala-2.11/scala/annotation · high confidence

Added Scala 2.13 compatibility shims for control and matching utilities

New compatibility package objects have been added for Scala 2.13 to ensure API consistency with newer Scala versions. The \scala.util.control.compat\ package now exposes \ControlThrowable\ as a type alias, and the \scala.util.matching.compat\ package exposes both the \Regex\ type and its companion object, allowing code to reference these standard library components through a unified compatibility layer.

compat/src/main/scala-2.13/scala/util · high confidence

Adds Scala 2.11/2.12 compatibility shim for @unused annotation

A compatibility shim for the \@unused\ annotation has been added to the \scala.annotation\ package for Scala 2.11 and 2.12. This new file provides a polyfill that delegates to the \@deprecated\ annotation, enabling codebases to use the \@unused\ marker on older Scala versions where it is not natively supported, ensuring consistent compiler behavior across supported Scala versions.

_compat/src/main/scala-2.11\2.12/scala/annotation · high confidence

Backport Scala 2.13 collection compatibility types to Scala 2.13 runtime

This change introduces compatibility shims in the \scala.collection.compat\ package for Scala 2.13 itself, specifically adding type aliases and values for \Factory\, \BuildFrom\, \IterableOnce\, \ArraySeq\, and \LazyList\. By re-exporting these Scala 2.13 standard library types under the \compat\ namespace, the library ensures that code written against the compatibility layer can reference these types consistently, effectively backporting the 2.13 collection API surface to the 2.13 runtime environment.

compat/src/main/scala-2.13/scala/collection · high confidence

Immutable ArraySeq update method deprecated

The \update\ method on \ArraySeq\ implementations (such as \ofInt\, \ofByte\, etc.) is now deprecated as of version 2.4.2. Attempting to call \update\ on an immutable \ArraySeq\ will throw an \UnsupportedOperationException\, reinforcing that these collections are strictly immutable and preventing accidental mutation.

_compat/src/main/scala-2.11\2.12/scala/collection/compat/immutable · high confidence

LazyList backport and Future migration rules

This release backports the immutable LazyList collection to Scala 2.11 and 2.12, providing a lazy, memoized linked-list implementation compatible with Scala 2.13. Additionally, it introduces a Scalafix rule that automatically migrates deprecated Future.onFailure and Future.onSuccess callbacks to the unified onComplete method, ensuring safer and more consistent error handling in codebases targeting older Scala versions.

repository · high confidence

Repository restructured and rebranded as scala-collection-compat

The project has been renamed from 'scalafix rewrites for collection-strawman' to 'scala-collection-compat' and restructured to include both the compatibility library and the migration tool. The repository now provides a compatibility layer for Scala 2.13 APIs on Scala 2.11 and 2.12, alongside scalafix rules (\Collection213Upgrade\ and \Collection213CrossCompat\) to assist in migrating codebases. Key changes include the addition of a \CODE\_OF\_CONDUCT.md\, a \CONTRIBUTING.md\ detailing how to add migration rules, and configuration files for \scalafmt\ (v3.11.5) and \scala-steward\. The build configuration now targets Scala 2.11, 2.12, and 2.13, with the library available for JVM, Scala.js, and Scala Native. The old \readme.md\ was removed and replaced with a comprehensive \README.md\ explaining usage, migration strategies, and cross-compilation support.

(repo-wide) · high confidence

Updated collection migration rules for Scala 2.13 compatibility

The scalafix rules in this location have been rewritten to handle modern Scala collection patterns, replacing legacy \CanBuildFrom\ usage with \Factory\ and \BuildFrom\, and updating \breakOut\ syntax. The rules now cover a broader range of collection operations, including \Set\/\Map\ addition and subtraction, \Map.zip\ and \mapValues\ transformations, and \Traversable\ iterator conversions. Additionally, support has been added for \rangeFrom\, \rangeTo\, and \rangeUntil\ on sorted collections, as well as \iterableFactory\ access on companion objects.

scalafix/output/src/main/scala/fix · high confidence

Test coverage

Add JavaConversions data source for migration testing; Add test inputs for JavaConversions migration rule; Added JVM-specific tests for LazyList garbage collection and string parsing; Added Scala.js tests for OptionConverters; Added Scalafix test suite; Added binary compatibility test using MiMa; Added negative test source for CanBuildFrom in Scala 2.13; Added source files for JavaConversions explicit, global, and specific import scenarios; Added test coverage for Scala collection compatibility features; Added tests for CollectionConverters; Added tests for Random.nextLong(long bound); Added tests for Scala-Java collection and Option converters; Added tests for compatibility-layer utility operations; Added tests for immutable collection conservation in ToConserve conversions; Added tests for scala.util.Using exception handling; Binary compatibility test for collection factory migration; New collection migration input fixtures for Scala 2.13 cross-compatibility; Removed Collectionstrawman rewrite test suite.

Dependencies

Build system upgraded to sbt 1.13 with Scala.js 1.20 and Scala Native 0.5.8

The build infrastructure has been significantly modernized: sbt has been upgraded from version 0.13.13 to 1.13.0, and the plugin ecosystem has been updated to include Scala.js 1.20.1, Scala Native 0.5.8, and sbt-scalafix 0.14.7. To support this multi-platform setup, new build definitions (\MultiScalaProject\, \Version\) were introduced to handle cross-compilation across JVM, JS, and Native targets for various Scala versions, replacing older cross-compilation mechanisms.

project · high confidence

Updated Scala versions to 2.12.20, 2.13.17, and 3.3.7

The build configuration has been updated to use newer versions of the Scala compiler: 2.12.20, 2.13.17, and 3.3.7. This ensures that the \scala-collection-compat\ library is built and tested against the latest stable releases of Scala 2.12, 2.13, and Scala 3, providing users with compatibility support for the most recent language features and standard library updates.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 68.

Lenses

  • Code Health 92
  • Architecture 100
  • Maturity 63
  • Readiness 66
  • Security 65

Changes since last survey

  • 300 commits — 294 feature/other, 6 fixes

By area

  • (root) — 105 commits
  • (repo) — 54 commits
  • project/build.properties — 54 commits
  • project/plugins.sbt — 39 commits
  • compat/src — 32 commits
  • .github/workflows — 12 commits
  • .github/dependabot.yml — 1 commit
  • compat/jvm — 1 commit
  • scalafix/output — 1 commit
  • scalafix/rules — 1 commit

Notable commits

  • fix: Fix [CVE redacted] for LazyList
  • fix: Fix native MiMa tests
  • fix: Merge pull request #526 from SethTisue/fix-scalafmt
  • fix: fix CI
  • fix: fix headerCheck
  • fix: fix publishing for custom Scala.js version on 2.11 (#714)
  • change: Add 'Reformat with scalafmt 3.10.4' to .git-blame-ignore-revs
  • change: Add Array.from extension for scala 2.11 and 2.12 (#658)
  • change: Add Iterator.nextOption
  • change: Add StringOps
  • change: Add RegexOps
  • change: Add a Scala 3 native build
  • change: Add a slim version of OptionConverters for JS only
  • change: Add dependabot.yml for GitHub Actions update
  • change: Add immutable.Map updatedWith and organize Map tests
  • change: Add implementation of distinctBy (#602)
  • change: Add javaapi collection forwarders for 2.12 and 2.11
  • change: Add mutable Map.updateWith (#508)
  • change: Add slim version of OptionConverters to native
  • change: Adjust build definition
  • …and 280 more

Architecture

  • 0 containers · 1 bounded contexts · 0 dependency edges (baseline)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

scala/scala-collection-compat was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a205778ec35763e32331b3c55291d4149b6de94b — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.