Questions tagged [scala-2.10]

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

This tag is for the 2.10 version of the Scala language. The contents of this version are not yet decided, as it has not yet been released.

Use only if your question is specifically related to features of this version. Just because you are using this version, doesn't mean you need this tag. Use in addition to or instead of this tag.

See for more information.

590 questions
8
votes
1 answer

Is this a bug in Scala 2.10 String Interpolation inside a multiline String with backslash?

Using Scala 2.10.0-RC1, I tried to use String Interpolation inside a Windows file path, e.g. like this: val path = s"""c:\foo\bar\$fileName.csv""" And got an Exception java.lang.StringIndexOutOfBoundsException: String index out of range:…
Eran Medan
  • 44,555
  • 61
  • 184
  • 276
8
votes
3 answers

Conditional scalacOptions with SBT

I am using a project with cross-build for Scala 2.8, 2.9 and (hopefully) 2.10, using SBT. I would like to add the -feature option when compiling with 2.10 only. In other words, when I compile with a version smaller than 2.10.0, I would like to set…
paradigmatic
  • 40,153
  • 18
  • 88
  • 147
8
votes
1 answer

Will it be possible to generate several top-level classes with one macro invocation in scala 2.10?

I have an program with lots of boilerplate (which is, sadly, not reducible even by Scala mechanisms). But if there would be a way to generate complex top-level classes with a macro, all that boilerplate will go away. For example: package…
Rogach
  • 26,050
  • 21
  • 93
  • 172
8
votes
3 answers

Using Scala 2.10 reflection how can I list the values of Enumeration?

Having a following enumeration object ResponseType extends Enumeration { val Listing, Album = Value } How do I get a list of its vals?
Nikita Volkov
  • 42,792
  • 11
  • 94
  • 169
8
votes
1 answer

Method that returns List of size n in Shapeless

Is it possible to make the following code work? def zeroTo[N <: Nat]:Sized[List[Int], N] = { new Sized[List[Int], N](List.iterate(0, toInt[N])(1+)) { type A = Int } } I get a compile error saying "could not find implicit value for parameter…
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
7
votes
1 answer

NoSuchMethodError while running Scalatest

I have created one small program and in order to test it I have write small Scala Test class. But when I tried to execute scala test I was getting below error, please advise, java.lang.NoSuchMethodError:…
Nishan
  • 375
  • 3
  • 16
7
votes
3 answers

Scala: How can I split a String into a Map

Environment : Scala 2.10+ IDE : Eclipse Kepler I have a line NAME=bala AGE=23 COUNTRY=Singapore How can I get it as a map Map(NAME -> bala, AGE -> 23, COUNTRY -> Singapore)
BalaB
  • 3,687
  • 9
  • 36
  • 58
7
votes
2 answers

Scala error: class file is broken, bad constant pool index

I'm trying to call the Selenium Java libraries from Scala. I'm using Scala IDE (Eclipse), and Scala 2.10.2. What is causing this compiler error? error while loading Function, class file…
Rob N
  • 15,024
  • 17
  • 92
  • 165
7
votes
3 answers

F-Bounded polymorphism with abstract types in Scala

I have read several articles expressing that abstract types should be used to achieve f-bounded polymorphism in Scala. This is primarily to alleviate type inference issues, but also to remove the quadratic growth that type parameters seem to…
Lawrence Wagerfield
  • 6,471
  • 5
  • 42
  • 84
7
votes
1 answer

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 scala code just as you would expect but when I try…
dankilman
  • 886
  • 2
  • 9
  • 18
7
votes
1 answer

In which case can Scala 2.10.0 compiler be faster or slower than 2.9.2?

I did a benchmark for compilation time on Scala 2.10.0 and 2.9.2, and have found that 2.10.0 took longer compilation time than 2.9.2. In which case does it happen? Or can Scala 2.10.0 compiler be generally slower than 2.9.2 for certain reasons?
Kenji Yoshida
  • 3,108
  • 24
  • 39
7
votes
3 answers

converting Akka's Future[A] to Future[Either[Exception,A]]

Is there a method in Akka (or in the standard library in Scala 2.10) to convert a Future[A] which might fail into a Future[Either[Exception,A]]? I know that you can write f.map(Right(_)).recover { case e:Exception => Left(e) } It just seems to be…
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
7
votes
1 answer

Runtime resolution of type arguments using scala 2.10 reflection

Given a type declaration, I am able to resolve the type argument. scala> reflect.runtime.universe.typeOf[List[Int]] match {case x:TypeRef => x.args} res10: List[reflect.runtime.universe.Type] = List(Int) For a runtime value, The same method doesn't…
Sagie Davidovich
  • 578
  • 4
  • 14
7
votes
2 answers

Is it possible to use reflection from SBT?

I am trying to generate some boilerplate with SBT (tool which is totally new to me). I am using shapeless sbt files as my main reference for the task. I have seen that this project uses code generation from scratch, but my case is slightly…
neutropolis
  • 1,884
  • 15
  • 34
7
votes
3 answers

ScalaMacros and Eclipse

I am trying to compile a (Scala) macro in Eclipse 3.7.2 with the Scala IDE Plugin available for Scala 2.10.0-M3, but I am experiencing the following error: "macro implementation not found: XXXXX (the most common reason for that is that you cannot…
neutropolis
  • 1,884
  • 15
  • 34