Version 2.10 of the Scala language for the JVM. Use only if your question is specifically related to features of this version.

learn more… | top users | synonyms

0
votes
0answers
32 views
+100

Mocking overloaded method

I am using scalamock to mock a class that contains some overloaded methods but I am getting some errors. For example: val out = mock[PrintStream] (out.print _).expects("cmd \r\n") Raises the ...
2
votes
2answers
60 views

Future[Future[T]] to Future[T] within another Future.map without using Await?

This is a theoretical question. I have a service I can call to do a job, but that service might not do all of it, and thus I will need to call a second one to finish it. I was wondering if there is a ...
0
votes
1answer
25 views

How do you use StaticQuery.update in Slick with parameters?

Could you please demonstrate how to use Slick's StaticQuery.update with parameters ? Documentation shows only parameterless call. I didn't find example in unit-tests either.
1
vote
1answer
63 views

Akka won't override application.conf with command line parameters

I thought since akka 2.1.4 uses typesafe config, it would just override whatever -D parameter I throw at it via command line, like play framework does. Turns out it doesn't seem to work that way. Just ...
4
votes
2answers
111 views

Changing the compiler's classpath from a Scala macro?

Say we wanted to build a feature like require, which is known in many scripting languages, in Scala. If we require a library like this... require("some-library.jar") ... we would need a way to add ...
4
votes
1answer
95 views

Scala: how to add type-dependent methods in trait?

I have the following idea: trait Generator[A] { def generate: Stream[A] // (1) If A <: Int def +(other: Generator[Int]): Generator[Int] = ( CustomGeneratorInt( ...
0
votes
1answer
45 views

How do you update multiple columns using Slick Lifted Embedding?

How do you update multiple columns using Slick Lifted Embedding ? This document doesn't say much. I expected it to be something like this Query(AbilitiesTable).filter((ab: AbilitiesTable.type) => ...
0
votes
1answer
37 views

Regex matching for number throws MatchError

I was trying to break the time string which is in hrs:min format using regex but it fails and gives MatchError. what is going on here? using Scala 2.10. scala> val minsecs = """\d+:\d+""".r ...
0
votes
1answer
38 views

Can I build update query with variable fields without using plain SQL?

Can I build update query with variable number of fields without using plain SQL ? For example update of single column is simple - I just yield it to create narrow query. ...
0
votes
1answer
30 views

Unable to figure out dependencies for spray.io's spray-servlet module

Relevant parts of my build.sbt are here: libraryDependencies ++= Seq ( "org.scalatest" % "scalatest_2.10" % "1.9.1" % "test", //Spray dependencies "io.spray" % "spray-servlet" % "1.1-M7", ...
0
votes
1answer
46 views

How can I use yield with Slick Query?

How can I use yield with Slick Query ? So imagine I have code like this def rolesQuery(owner_id: UUID) = for { (role, rel) <- Roles innerJoin AbilitiesMapping on (_.id === _.obj_id) if ...
2
votes
1answer
44 views

Is it possible to get the typeTag of a runtime instance?

Using scala 2.10, I am trying to instantiate a class from a string and I would like to get its typetag. for example : scala> def printClassName[Y: TypeTag](x: Y) = { println(typeTag[Y].tpe) } ...
0
votes
2answers
48 views

Inner join doesn't work in Slick

Could you please tell me why I'm not getting inner join I'm expecting to get ? I have following tables case class Ability(id: UUID, can: Boolean, verb: String, subject: String, context: String) ...
1
vote
1answer
49 views

Scala unbound placeholder parameter

I am using the following code to meet my needs: (1 to 5)..map(i => s"\\x${i}") // Produces List("\\x1", "\\x2", "\\x3", "\\x4", "\\x5") But I would like to use a placeholder. According to the ...
4
votes
1answer
93 views

scala specialization - using object instead of class causes slowdown?

I've done some benchmarks and have results that I don't know how to explain. The situation in a nutshell: I have 2 classes doing the same (computation heavy) thing with generic arrays, both of ...
0
votes
1answer
44 views

How to prevent debugger from stepping into Object class code in Eclipse when developing with Scala?

In my file file.scala, I have the following line: `file.scala` > shapes.foreach({ shape => ... When I start to debug it using Eclipse 3.7, scala plug-in version 2.1.0mp3, I press ...
0
votes
1answer
100 views

Scala Compiler crash: What's wrong here?

I was starting to write a unit test for an X500PrincipalBuilder class in Scala. Here's my test code: import org.junit.runner.RunWith import org.scalatest.WordSpec import ...
1
vote
2answers
92 views

Scala 2.10 - Octal escape is deprecated - how to do octal idiomatically now?

See https://issues.scala-lang.org/browse/SI-5205 and https://github.com/scala/scala-dist/pull/20 Octal escape value leading 0 has been deprecated from scala and I don't see an idiomatic alternative. ...
2
votes
5answers
95 views

How can I use library which is built using 2.9.2 in project which is built using 2.10.1?

How can I use library build against 2.9.2 in project which is built using 2.10.1 ? In particular I'm trying to use salat and get following exception sbt.ResolveException: unresolved dependency: ...
1
vote
1answer
62 views

Did Scala case class annotations change in 2.10?

In Scala 2.9 I would annotate a case class using the import scala.annotation.target.field: case class UserAuth( @(JsonProperty@field)("email") val email: String, ...
0
votes
1answer
31 views

Field 'age2' can only be read from 'application/x-www-form-urlencoded' form content

Could you guys tell me why following form of extraction works for both multipart/form-data and x-www-form-urlencoded requests formFields("firstName"?, "age2"?, "sex", "vip"?) { (firstName : ...
0
votes
1answer
45 views

How do you deserialize immutable collection using Kryo?

How do you deserialize immutable collection using Kryo ? Do I need to register something in addition to what I've done ? Here is my sample code import com.esotericsoftware.kryo.Kryo import ...
1
vote
1answer
108 views

Scala deserialization: class not found

I'm trying to understand the following issue that occurs when trying to serialize/deserialize a very simple data structure: case class SimpleClass(i: Int) object SerializationDebug { def ...
0
votes
1answer
103 views

Splitting string using Regex and pattern matching throws an exception

Could you guys please tell me what I'm doing incorrectly trying to extract using regex pattern-matching? I have following code val Pattern = "=".r val Pattern(key, value) = "key=value" And I get ...
2
votes
2answers
116 views

How do you write shortened version of function literal?

Could you please explain to me how to write shortened version of function literal ? I'm going through this Spray tutorial in which following code val route: Route = { ctx => ctx.complete("yeah") ...
1
vote
0answers
54 views

ScalaMock 3. Mocking methods with function parameter

I would like to mock methods with a function parameter and a function parameter in combination with curried paramters like: trait Secured { def IsAuthenticated(f: AuthenticatedData => ...
1
vote
1answer
74 views

traits with immutable paramiters in scala

I want to make the following example so that Collar is immutable trait Collar{ var text:String=""; } class dog(val name:String){ def bark()= ... } val snoopy = new ...
0
votes
1answer
43 views

extending scala collections for a specific member type

I want to do something like class Pack extends collection.immutable.List[Dog]{ def pullSled() = //... } But the Scala compiler tells me illegal inheritance from sealed class List This would be ...
1
vote
1answer
51 views

How to fix broken unit testing after upgrading Typesafe Stack?

I just upgraded to Typesafe IDE for Scala 2.10.1 (I had been using 2.9.something). Scala works, but unit testing with org.scalatest no longer works. I get java.lang.NoClassDefFoundError: ...
2
votes
1answer
78 views

Working with collections of mixed complex Java generics in Scala 2.10

In the company I work for we get many benefits from a (Java) pattern that can be summarized as follows: There are "things" that we can get by their special/smart "ids". Each "thing" knows its id, and ...
3
votes
1answer
83 views

Scala 2.10, Double.isNaN, and boxing

In Scala 2.10, is someDouble.isNaN expected to box? Running my code calling .isNaN through a decompiler, I still see telltale calls to double2Double in my code. Given the new AnyVal work in 2.10, I'd ...
2
votes
1answer
174 views

Scala and Java interop. of Future

In this problem I have to call a third-party Java library that expects a java.util.concurrent.Future with a result from a Scala routine returning a scala.concurrent.Future as for example. def ...
3
votes
2answers
122 views

Scala 2.10 reflection, how do I extract the field values from a case class

How can I extract the field values from a case class in scala using the new reflection model in scala 2.10? For example, using the below doesn't pull out the field methods def ...
0
votes
1answer
87 views

How can I use Scala2.10+Play2.1+Jerkson?

It seems Jerkson is no more available within Play2.1 (Scala 2.10) and I cannot find a solution on the Internet.
3
votes
0answers
112 views

Strange behavior of toolbox compilation when referencing an inner static java class

Supposed I have the following java class: package com.test; public class Outer { public static class Inner { public static final String VAL = "Inner"; } } I can reference the VAL constant from ...
1
vote
1answer
120 views

How do I throttle messages in Akka (2.1.2)?

Could you guys please show example of throttling messages in Akka ? Here is my code object Program { def main(args: Array[String]) { val system = ActorSystem() val actor: ActorRef = ...
3
votes
1answer
122 views

How to get Option[T] field type on Android in 2.10.1?

Code like this: import scala.reflect.runtime.{universe => ru, currentMirror => cm} import ru._ def test[T:TypeTag](obj: T) { for (c <- typeOf[T].declarations; if ...
3
votes
2answers
120 views

Does Scala have a 'unique list' type?

I'm looking for something like the immutable SortedSet, except I want elements to be ordered in the sequence they were passed into the constructor. UniqueList(4,2,3,1,1) // Throws exception ...
1
vote
1answer
192 views

Json serialization in Scala 2.10

Before Play 2.1 and Scala 2.10 I used Jerkson. Unfortunatly there is no officially released Jerkson version compatible with Scala 2.10 (yet). I'm since using Jackson with Scala module but I don't ...
1
vote
0answers
57 views

Importing members in scala 2.10

In Scala 2.9.x I was used to the following syntax: class B(currencies: Seq[Currency])(implicit c:C) extends CSomething(c){ import c._ // def mystuff = call() // in fact this is c.call() } This ...
1
vote
3answers
86 views

Can't get inherited vals with Scala reflection

I'm using Scala 2.10.1 and I'm trying the define a method which will retrieve all the vals (including the inherited ones) from an object. I have the following: import scala.reflect.runtime.{universe ...
3
votes
1answer
90 views

Why must type parameter must be defined in Scala 2.10

I have the following case class: case class Alert[T <: Transport](destination: Destination[T], message: Message[T]) In Scala 2.9.2, the following method signature would compile fine: def ...
1
vote
0answers
77 views

Compiler bug? java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to java.lang.Integer

Scratching my head over a weird runtime error: // File: build.sbt scalaVersion := "2.10.1" // File: src/main/scala/bug/Bug.scala package bug class Foo(val args: Any*) case class Bar(id: Int) ...
0
votes
0answers
46 views

“Bridge generated for member method … clashes with definition of the member itself.”

While working on scala-pipes, I was presented with the following error message, replicated nine times in different places in the code: [error] ...
4
votes
2answers
190 views

Getting type information inside scala repl via IMain

Intent I am trying to add support for :kind command to scala repl. Thanks to Eugene Burmako, I was able to get a working prototype. Though it only works with fully qualified names and fails to ...
1
vote
1answer
140 views

Parse a string containing code, return a Type

I want to parse a piece of scala code, contained in a String and get the resulting reflect.runtime.universe.Type of that expression (String => Type). I've tried: scala> import ...
2
votes
1answer
130 views

How to run a spray server on heroku with Scala 2.10?

I've created a Spray app with a simple REST service. I've followed a variation of the instructions provided by heroku. Variations: used sbt.version=0.12.0 used Build.scala instead of build.sbt used ...
3
votes
1answer
244 views

How to get more information about 'feature' flag warning?

When compiling an application with Play2, sometimes these kind of message appears on my terminal : [info] Compiling 1 Scala source to ~/target/scala-2.10/classes... [warn] there were 1 feature ...
1
vote
1answer
53 views

scalap detection of value classes

I'm using scalap to pick apart information about Scala classes. Works fine for case classes, but I want to see if a class is a value class. So far I haven't found anything that will tell me that. ...
8
votes
2answers
181 views

How to distinguish compiler-inferred implicit conversion from explicitly invoked one?

Let's imagine passing these two equivalent expressions to a Scala macro: with compiler-inferred implicit conversion: 1+"foo" with explicitly invoked implicit conversion: any2stringadd(1)+"foo" Is ...

1 2 3 4 5
15 30 50 per page