Questions tagged [scala-2.13]

Version 2.13 of the Scala programming language. Use for questions particularly addressing features of this version of Scala.

Scala 2.13 brings improvements in

  • compiler performance
  • simplifying the collections
  • modularizing the standard library
  • user-friendliness
100 questions
2
votes
1 answer

How to convert this SetLike collection from Scala 2.12 to 2.13?

I have this simple immutable Long-based bitset that contains the Card case class. Unfortunately, with the Scala 2.13 collections revamp, it does not compile anymore. I have looked at the BitSet implementation in Scala 2.13, but it is very verbose.…
Rok Kralj
  • 46,826
  • 10
  • 71
  • 80
2
votes
1 answer

Scala compilation issue "forward reference extends over definition of value"

Compilation error occurs for the below snippet only when it is method level implementation and error does not occur when it is defined in main. What is the difference ? Scala version used is 2.13.5. class FibonacciGenerator { def generate(total:…
nashter
  • 1,181
  • 1
  • 15
  • 33
2
votes
3 answers

Migrate a Traversable that uses a visitor to an Iterable in Scala 2.13

The migration guide to Scala 2.13 explains that Traversable has been removed and that Iterable should be used instead. This change is particularly annoying for one project, which is using a visitor to implement the foreach method in the Node class…
Federico
  • 1,925
  • 14
  • 19
2
votes
1 answer

In scala 2.13, why sometimes TypeTags cannot be inferred? And how to construct one from a variable symbol?

Here is a simple example in shapeless: it("from Witness") { val ttg = implicitly[TypeTag[Witness.Lt[String]]] val ctg = implicitly[ClassTag[Witness.Lt[String]]] } it("... from macro") { val ttg =…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
2
votes
1 answer

In scala 2.13, why is it sometimes impossible to summon type class explicitly?

Here is a simple example in shapeless 2.3.3: val book = ("author" ->> "Benjamin Pierce") :: ("title" ->> "Types and Programming Languages") :: ("id" ->> 262162091) :: ("price" ->> 44.11) :: HNil val v1 =…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
2
votes
1 answer

Scala Compiler throws: java.lang.IllegalAccessError: Class 'scala.tools.nsc.transform.patmat.PatternExpansion$ExtractorAlignment'

After upgrading one of my projects to scala 2.13.4 I get the following error: [error] java.lang.IllegalAccessError: Class 'scala.tools.nsc.transform.patmat.PatternExpansion$ExtractorAlignment' no access to: class…
Frederick Roth
  • 2,748
  • 4
  • 28
  • 42
2
votes
1 answer

Is there a way to use the type of an object as the argument of a type parameter?

I'm trying to use shapeless to do additions and removals from Hlists. But I can't seem to get it to work. So I here are my lists: object ShapelessExample { import shapeless._ def main(args: Array[String]): Unit = { case class…
Ryan Stull
  • 1,056
  • 14
  • 35
2
votes
0 answers

Scala 2.13.1 error when compiling en "java.lang.NoClassDefFoundError: scala/collection/TraversableOnce"

I'm switching from Scala 2.12 to 2.13.1. When I compile the project in sbt I get this error: [error] java.lang.NoClassDefFoundError: scala/collection/TraversableOnce [error] java.lang.Class.forName0(Native Method) [error]…
M.G.
  • 369
  • 1
  • 14
2
votes
1 answer

Version agnostic way to convert from Java to Scala collections and back

Almost each Scala version changes the way collection conversion happens in a non-backward compatible way. Is there a better solution that is version agnostic and does not depend on Scala distribution? I don't mind using some 3rd party libraries.
Jus12
  • 17,824
  • 28
  • 99
  • 157
2
votes
1 answer

For Scala 2.13, what is the fastest method for updating a LongMap, HashMap, or TrieMap with millions of updates?

Goal I have a mutable Map[Long, Long] with millions of entries. I need to make many iterations of updates with millions of updates. I would like to do this as fast as possible. Background Currently, the fastest method is to use a single threaded…
2
votes
2 answers

How to create param for superclass constructor without early initialiser in Scala

Since Scala 2.13 early initialisers are deprecated. How can I create a value to pass to a superclass which should be computed (based on other constructor arguments) and completely private, so on class initialisation it cannot be passed? An example…
Jac
  • 531
  • 1
  • 4
  • 19
1
vote
1 answer

Implement function which output type is depend on input type

Let imagine I have the following traits/classes hierarchy ( scala 2.13 ) trait In trait Out case class In1() extends In case class In2() extends In case class Out1() extends Out case class Out11() extends Out case class Out2() extends Out I'd…
Pizza eu
  • 1,419
  • 1
  • 14
  • 27
1
vote
0 answers

Unable to render images to a PPTX slideshow using Apache POI

I have this code that reads a .pptx template file to fetch placeholder mappings and then subsequently replace these placeholders with actual data. It uses Apache POI in Scala. Here is my code: def replaceTags(slide: XSLFSlide, data: Data, slideShow:…
kajoe14
  • 23
  • 5
1
vote
0 answers

How to create two or more GSI in Local DynamoDB using Scanamo

I would like to create two or more Global Secondary Indexes (GSI) using Scanamo v1.0.0-M23 and in particular case class UnLocation( id: Option[UUID], countryCode: String, unCode: String, name: String, asciiName: String, …
sentenza
  • 1,608
  • 3
  • 29
  • 51
1
vote
0 answers

Scala 2 overload resolution with varargs and Object

I am trying to understand the following behavior in Scala 2.13.10 with respect to method overloading selection. import scala.collection.JavaConverters._ object Test { def func(v: AnyRef*) = { println("varargs") } def func(v: Map[String, AnyRef])…
TroyStacer
  • 23
  • 1
  • 3