Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-Scala 2.13: Fix JavaConversions warnings with scala-collection-compat #526

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Aug 7, 2024

This codebase was using scala.collection.JavaConversions._, which has been deprecated since Scala 2.12. Rather than update to Scala 2.12 syntax, and then later to Scala 2.13 syntax, here we use the scala-collection-compat library to allow us to use Scala 2.13 syntax immediately.

The scala-collection-compat library comes with a choice of ScalaFix migrations to automate this update:

https://github.com/scala/scala-collection-compat?tab=readme-ov-file#migration-rules

...but they didn't work well for us (introduced a lot of .iterator calls on Iterables, for some reason) so we made these changes manually.

@rtyley rtyley added the Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 label Aug 7, 2024
@rtyley rtyley requested a review from JamieB-gu September 10, 2024 15:57
@rtyley rtyley force-pushed the pre-scala-2.13-fix-JavaConversions-warnings branch from d8978bc to 341e2ab Compare September 10, 2024 15:57
…ompat`

This codebase was using `scala.collection.JavaConversions._`, which has been deprecated
since Scala 2.12. Rather than update to Scala 2.12 syntax, and then later to Scala 2.13
syntax, here we use the https://github.com/scala/scala-collection-compat library to
allow us to use Scala 2.13 syntax immediately.

The scala-collection-compat library comes with a choice of ScalaFix migrations to automate
this update:

https://github.com/scala/scala-collection-compat?tab=readme-ov-file#migration-rules

...but they didn't work well for us (introduced a lot of `.iterator` calls on
`Iterable`s, for some reason) so we made these changes manually.
@rtyley rtyley force-pushed the pre-scala-2.13-fix-JavaConversions-warnings branch from 341e2ab to 70aea35 Compare September 10, 2024 16:20
@rtyley rtyley merged commit c41e55f into main Sep 10, 2024
3 checks passed
@rtyley rtyley deleted the pre-scala-2.13-fix-JavaConversions-warnings branch September 10, 2024 16:30
@prout-bot
Copy link

Overdue on PROD (merged by @rtyley 30 minutes and 3 seconds ago) What's gone wrong?

@prout-bot
Copy link

Seen on PROD (merged by @rtyley 35 minutes and 17 seconds ago) Please check your changes!

@rtyley rtyley mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 Seen-on-PROD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants