Questions tagged [scala-2.12]

Version 2.12 of the Scala programming language.

Version 2.12 of the programming language. Notable is that it will require Java 8.

75 questions
20
votes
3 answers

java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

After installing JDK9, I get this exception when running my Scala projects. Upgrading Scala to 2.12.2 also didn't resolve my problem.
abshar
  • 467
  • 1
  • 4
  • 8
14
votes
2 answers

Scala-Cats Validated: value mapN is not a member of ValidatedNel tuple

Scala community. Currently I'm trying to implement custom model/single parameter validation using cats Validated Monad. But, after removal of Cartesian product since 1.0 I'm unable to use (v1 |@| v2) map (f) and unable to compile my code: import…
dev
  • 145
  • 1
  • 7
7
votes
2 answers

Scala hex literal for bytes

Hex literal containing A-F digit are converting to int by default. When I am trying to declear an Int with 0x it is creating correctly. val a: Int = 0x34 val b: Int = 0xFF But when I am trying to declear a Byte with 0x second line is not…
Nafeez Abrar
  • 1,045
  • 10
  • 27
7
votes
1 answer

Scala Script: Explain this class cast error to ScalaClassLoader on Windows

Consider following scala script: import scala.reflect.internal.util.ScalaClassLoader object Test { def main(args: Array[String]) { val classloaderForScalaLibrary = classOf[ScalaClassLoader.URLClassLoader].getClassLoader …
Kshitiz Sharma
  • 17,947
  • 26
  • 98
  • 169
7
votes
1 answer

Implicit ExecutionContext priority in Scala 2.12

In Scala 2.12 importing the global execution context and then having another implicit execution context defined in the scope results in an ambiguous implicit, while in 2.11 it works just fine. import scala.concurrent._ import…
ochrons
  • 691
  • 5
  • 10
7
votes
1 answer

Scala 2.12 uses Java 1.8; what should we do if we are unable to upgrade to Java 1.8?

The release of Scala 2.12 Milestone 1 indicates it requires Java 1.8. What should Scala users who are not able to go to Java 1.8 at this moment plan to do?
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
5
votes
2 answers

Scala incompatible nested types created in implicit class

The code fragment provided is a made-up minimalistic example just to demonstrate the issue, not related to actual business logic types. In the code below we have a nested Entry type inside Registry type. class Registry[T](name: String) { case…
Ivan Klass
  • 6,407
  • 3
  • 30
  • 28
5
votes
1 answer

For comprehensions Future and Either

I am struggling in how to compose a sequence of asynchronous processes in a nice monadic way. Each step of the process could fail so it is retrieving a Future[Either[String, T]]. def firstStep(input: Int): Future[Either[String, Long]] = ??? def…
Mikel San Vicente
  • 3,831
  • 2
  • 21
  • 39
5
votes
1 answer

Scala get the line and file of a functions invocation at compile-time

What I want to have is a function that is able to print the lines + file from where it was called. The behavior would be something like this: log("x") //Called at line 15 of file Blax.scala Should print Blax.scala, line 15, message: x Something…
George
  • 3,521
  • 4
  • 30
  • 75
5
votes
3 answers

WS in Play become incredible complex for 2.6.X

For Play 2.3.X the WS module is very easy to be used: WS.url(s"http://$webEndpoint/hand/$handnumber").get() For the such simple and strightforward usage. While in Play 2.6.x according to the link :…
wherby
  • 704
  • 1
  • 5
  • 16
5
votes
0 answers

Implicit argument getting SAM'd?

Here's some code that compiles in 2.11, but fails in 2.12: object Main extends App { implicit val c: Configured[String] = new Configured[String] { def apply(v: CfgValue): Option[String] = None } val a = Configured[String] } sealed trait…
Reactormonk
  • 21,472
  • 14
  • 74
  • 123
5
votes
4 answers

How to add a time based watcher to a Scala Future?

I want to add an after(d: FiniteDuration)(callback: => Unit) util to Scala Futures that would enable me to do this: val f = Future(someTask) f.after(30.seconds) { println("f has not completed in 30 seconds!") } f.after(60.seconds) { println("f…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
5
votes
1 answer

Scala parser cuts last bracket

Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121). Type in expressions for evaluation. Or try :help. scala> :paste // Entering paste mode (ctrl-D to finish) import scala.reflect.runtime._ import…
Andrzej Jozwik
  • 14,331
  • 3
  • 59
  • 68
4
votes
0 answers

Regex named capturing groups throw IllegalStateException in Scala

Edit 1: @GoodDok I can't use val regex = """(\d+) (\S+)""".r("Id", "Name") because regex pattern and matched string are supplied by user. Number of groups and naming is custom every time. Edit 2: @Wiktor Stribiżew The question is different than…
4
votes
1 answer

Scala Future.find

Scala 2.12 has 2 Future.find methods. @deprecated("use the overloaded version of this method that takes a scala.collection.immutable.Iterable instead", "2.12.0") def find[T](@deprecatedName('futurestravonce) futures:…
suish
  • 3,253
  • 1
  • 15
  • 34
1
2 3 4 5