scala-2.9

Using ListView from Scala 2.9.2 with Java 7 gives compile error

谁说我不能喝 提交于 2019-12-06 00:26:19
问题 I'm working on a project that use scala 2.9.2 and java 7. What I'm trying to do is create a GUI using the scala ListView. Here's a small code snippet: private val listView = new ListView[Document](someList) . . . for (selectedDocument <- listView.peer.getSelectedValuesList) { doSomething(selectedDocument) } This gives me the following compile error: error: something is wrong (wrong class file?): class JList with type parameters [E] gets applied to arguments [], phase = namer for

How can I use Scala's MurmurHash implementation: scala.util.MurmurHash3?

做~自己de王妃 提交于 2019-12-05 18:16:08
I'm writing a BloomFilter and wanted to use Scala's default MurmurHash3 implementation: scala.util.MurmurHash3. My compile is failing however with the following compile error: [error] /mnt/hgfs/dr/sandbox/dr-commons/src/main/scala/dr/commons/collection/BloomFilter.scala:214: MurmurHash3 is not a member of scala.util [error] import scala.util.{MurmurHash3 => MH} I'm using Scala 2.9.1 and sbt 0.11.2. Is the MurmurHash3 class not in the 2.9.1 library by default? I assume it is since it's used a lot in the library. The class isn't package private as far as I see. Paolo Falabella It's called just

Methods in trait become volatile methods when mixed in concrete classes in 2.9.0-1 but not 2.8.1

此生再无相见时 提交于 2019-12-05 17:14:44
I noticed this breaking (for me using it with OGNL) change in 2.9.0-1: I find that, in 2.9, methods declared in a trait become volatile when mixed in a class: Example in 2.9.0-1 import java.lang.reflect.Modifier trait SuperTrait { def getKnoll = "Kanutten" } class KlassWithKnoll extends SuperTrait { def getKnall = "Mars" } val qsc = classOf[KlassWithKnoll] val knollGetter = qsc.getDeclaredMethod("getKnoll") println("isVolatile: " + Modifier.isVolatile(knollGetter.getModifiers())) This prints out isVolatile: true But in 2.8.1: it prints out isVolatile: false This is actually a breaking change

Strange behavior of Set4 in scala 2.9.1?

天大地大妈咪最大 提交于 2019-12-05 02:38:56
Making a migration from 2.8.1 to 2.9.1 found interesting thing. Tried to write this in console: >>import collection.immutable.Set.Set4 >>new Set4[Int](1,2,3,4) It gives: java.lang.Error: Unexpected New at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:34) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$bac .......................... That entry seems to have slain the compiler. Shall I replayscala:660) your session? I can re-run each line except the last one.reach(ListBuffer.scala: [y/n]? I am using Scala version 2.9.1.final (Java HotSpot(TM) Client VM, Java 1.6

What new features will be added to Scala 2.9?

痞子三分冷 提交于 2019-12-04 16:01:57
问题 I know parallel collections will become available. What form will these take, and what else are we likely to see? 回答1: For the full list, see: Beyond 2.8 - A Roadmap The main thing seems to be parallel collections. They are drop-in replacement for the scala collections, but the methods are executed in parallel. From the scala days presentation by Aleksandar Prokopec: Scala parallel collections that will be introduced in 2.8 reimplement standard collection operations while keeping

How do I replace the fork join pool for a Scala 2.9 parallel collection?

假装没事ソ 提交于 2019-12-04 08:35:33
问题 I've been looking at the new Scala 2.9 parallel collections and am hoping to abandon a whole lot of my crufty amateur versions of similar things. In particular, I'd like to replace the fork join pool which underlies the default implementation with something of my own (for example, something that distributes evaluation of tasks across a network, via actors). My understanding is that this is simply a matter of applying Scala's paradigm of "stackable modifications", but the collections library

Using ListView from Scala 2.9.2 with Java 7 gives compile error

不羁的心 提交于 2019-12-04 07:34:26
I'm working on a project that use scala 2.9.2 and java 7. What I'm trying to do is create a GUI using the scala ListView. Here's a small code snippet: private val listView = new ListView[Document](someList) . . . for (selectedDocument <- listView.peer.getSelectedValuesList) { doSomething(selectedDocument) } This gives me the following compile error: error: something is wrong (wrong class file?): class JList with type parameters [E] gets applied to arguments [], phase = namer for (selectedDocument <- listView.peer.getSelectedValuesList) { I'm guessing this is because in ListView, peer is

Why do case classes extend only Product and not Product1, Product2, …, ProductN?

旧城冷巷雨未停 提交于 2019-12-04 00:14:46
after I learned that case classes extend Product, I wondered why they do not extend ProductN. E.g., given a code like: case class Foo(a: Int) I'd expect Foo(1).asInstanceOf[Product1[Int]] to work, but it does not (checked with Scala 2.9.1, and confirmed by other sources and by Product documentation). I was interested in this, because I wanted to declare classes such as: abstract class UnaryOp[T1 <: Exp[_], R](t1: T1) extends Exp[R] { this: Product1[T1] => } This way, a node for a Unary operation must be implement Product1. It would be nice if being simply a case class with one parameter would

How do I replace the fork join pool for a Scala 2.9 parallel collection?

江枫思渺然 提交于 2019-12-02 22:29:37
I've been looking at the new Scala 2.9 parallel collections and am hoping to abandon a whole lot of my crufty amateur versions of similar things. In particular, I'd like to replace the fork join pool which underlies the default implementation with something of my own (for example, something that distributes evaluation of tasks across a network, via actors). My understanding is that this is simply a matter of applying Scala's paradigm of "stackable modifications", but the collections library is intimidating enough that I'm not exactly sure which bits need modifying! Some concrete questions: Is

How does one implement a Hadoop Mapper in Scala 2.9.0?

旧时模样 提交于 2019-11-30 20:04:50
When I migrated to Scala 2.9.0 from 2.8.1, all of the code was functional except for the Hadoop mappers. Because I had some wrapper objects in the way, I distilled down to the following example: import org.apache.hadoop.mapreduce.{Mapper, Job} object MyJob { def main(args:Array[String]) { val job = new Job(new Configuration()) job.setMapperClass(classOf[MyMapper]) } } class MyMapper extends Mapper[LongWritable,Text,Text,Text] { override def map(key: LongWritable, value: Text, context: Mapper[LongWritable,Text,Text,Text]#Context) { } } When I run this in 2.8.1, it runs quite well (and I have