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

Scala 2.13: Fix various syntax errors #25425

Merged
merged 8 commits into from
Aug 26, 2022

Commits on Aug 23, 2022

  1. Remove call in deprecated seq method of Iterable

    To get rid of this error:
    
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/admin/app/tools/charts/charts.scala:50:15: method seq in trait Iterable is deprecated (since 2.13.0): Iterable.seq always returns the iterable itself
    [error]     chartRows.seq
    [error]               ^
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    ebc0672 View commit details
    Browse the repository at this point in the history
  2. Replace deprecated unicode escapes in triple quoted strings

    To get rid of the error:
    
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/common/StringEncodings.scala:19:22: Unicode escapes in triple quoted strings are deprecated, use the literal character instead
    [error]       .replaceAll("""\u2028""", """\\u2028""")
    [error]                      ^
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/common/StringEncodings.scala:20:22: Unicode escapes in triple quoted strings are deprecated, use the literal character instead
    [error]       .replaceAll("""\u2029""", """\\u2029""")
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    b596f2c View commit details
    Browse the repository at this point in the history
  3. Use linesIterator on String instead of lines on a WrappedString

    `lines` is not a method of `WrappedString` anymore but we can call `linesIterator` on a String after it has been undeprecated in this PR: scala/scala#7269
    
    This way we get rid of the following error:
    
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/common/TrailsToShowcase.scala:509:46: value lines is not a member of scala.collection.immutable.WrappedString
    [error]     val lines = new WrappedString(trailText).lines.toSeq
    [error]                                              ^
    [error] one error found
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    9993fb3 View commit details
    Browse the repository at this point in the history
  4. Be strict about using a Long value

    Scala 2.13 compiler does not recoginise this is Long anymore so we have to be more specific.
    
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/common/configuration.scala:213:95: type mismatch;
    [error]  found   : AnyVal
    [error]  required: Long
    [error]       Duration.create(configuration.getIntegerProperty("content.api.timeout.millis").getOrElse(2000), MILLISECONDS)
    [error]
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    53e894d View commit details
    Browse the repository at this point in the history
  5. Replace deprecated Traversable with Iterable

    To get rid of the following error:
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/model/Badges.scala:174:26: type Traversable in package scala is deprecated (since 2.13.0): Use Iterable instead of Traversable
    [error]   def badgeForTags(tags: Traversable[String]): Option[Badge] = {
    [error]
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    7aaf61a View commit details
    Browse the repository at this point in the history
  6. Replace deprecated Stream with LazyList

    To get rid of the following error:
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/model/CrosswordGridModel.scala:18:30: value Stream in package scala is deprecated (since 2.13.0): Use LazyList instead of Stream
    [error]     (('A' to 'Z').toList.zip(Stream from 0) map { case (letter, number) => (number, letter) }).toMap
    [error]
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    027bd32 View commit details
    Browse the repository at this point in the history
  7. Add @uncheched in superfluous pattern matching check

    Scala 2.13 compiler is stricter in checking whether pattern matching has been exhaustive but in this case we don't need to check for `Nil` because split() never gives the empty list.
    
    To get rid off the following error:
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/model/facia.scala:24:21: match may not be exhaustive.
    [error] It would fail on the following input: Nil
    [error]     path.split('/').toList match {
    [error]                     ^
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    2fbfdcf View commit details
    Browse the repository at this point in the history
  8. Replace deprecated method replaceAllLiterally with replace in a Strin…

    …gOps
    
    To get rid of the following error:
    ```
    [error] /Users/Ioanna_Kokkini/Projects/frontend/common/app/pagepresser/HtmlCleaner.scala:200:9: method replaceAllLiterally in class StringOps is deprecated (since 2.13.2): Use `s.replace` as an exact replacement
    [error]     src.replaceAllLiterally("http://", "//")
    [error]         ^
    ```
    ioannakok committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    344573f View commit details
    Browse the repository at this point in the history