- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Problem with adding Kilim (java lib) to my Scala netbeans project
Fri, 2009-02-13, 13:41
hi,
i'm trying to use kilim with scala and i cannot get a proper compile.
this might be due to me being new with the netbeans plugin... first
is, i put all kilim classes into a kilim.jar that i copied into my
netbeans project folder and added it to the Libraries tree, so it
shows up in the project properties in the libraries category under
"Compile-time Libraries". still the netbeans plugin complains about
the "import kilim._" line, saying that this symbol was not found.
ok, so i copied kilim.jar to my system wide class path /Library/
Extensions/Java and relaunched netbeans, fine, no more errors showing
up in the editor. but when i press Run, the compilation fails with
Compiling 1 source file to /Users/rutz/Documents/netbeans/
ScalaApplication1/build/classes
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:87)
at
scala.tools.nsc.symtab.classfile.ClassfileParser.arrayToRepeated
(ClassfileParser.scala:514)
at
scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod
(ClassfileParser.scala:503)
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
$parseClass$2.apply(ClassfileParser.scala:410)
at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
$parseClass$2.apply(ClassfileParser.scala:410)
at scala.Range.foreach(Range.scala:44)
at
scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass
(ClassfileParser.scala:410)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse
(ClassfileParser.scala:86)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
$anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
$anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
at scala.tools.nsc.symtab.SymbolLoaders.completeClassfile
(SymbolLoaders.scala:276)
at scala.tools.nsc.symtab.SymbolLoaders
$ClassfileLoader.doComplete(SymbolLoaders.scala:289)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete
(SymbolLoaders.scala:77)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load
(SymbolLoaders.scala:97)
at scala.tools.nsc.symtab.Symbols$Symbol.exists
(Symbols.scala:387)
at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1
(Typers.scala:2902)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3252)
at scala.tools.nsc.typechecker.Typers
$Typer.typedAppliedTypeTree$1(Typers.scala:2992)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3276)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers
$Typer.typedTypeConstructor(Typers.scala:3411)
at scala.tools.nsc.typechecker.Typers
$Typer.typedTypeConstructor(Typers.scala:3419)
at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1
(Typers.scala:2425)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3155)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier
(Typers.scala:3380)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3240)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
$typedApply$1$1.apply(Typers.scala:2607)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
$typedApply$1$1.apply(Typers.scala:2607)
at scala.tools.nsc.typechecker.Typers$Typer.silent
(Typers.scala:583)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1
(Typers.scala:2607)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3219)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3371)
at scala.tools.nsc.typechecker.Typers$Typer.computeType
(Typers.scala:3422)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig
(Namers.scala:859)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
$typeCompleter$1.apply(Namers.scala:415)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
$typeCompleter$1.apply(Namers.scala:413)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete
(Namers.scala:982)
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
510)
at scala.tools.nsc.symtab.Symbols$Symbol.initialize
(Symbols.scala:624)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3040)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3360)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
(Typers.scala:1570)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.List$.loop$1(List.scala:293)
at scala.List$.mapConserve(List.scala:310)
at scala.List$.loop$1(List.scala:297)
at scala.List$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer.typedBlock
(Typers.scala:1404)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3083)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3371)
at scala.tools.nsc.typechecker.Typers$Typer.computeType
(Typers.scala:3422)
at scala.tools.nsc.typechecker.Namers$Namer.methodSig
(Namers.scala:759)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig
(Namers.scala:848)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
$typeCompleter$1.apply(Namers.scala:415)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
$typeCompleter$1.apply(Namers.scala:413)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete
(Namers.scala:982)
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
510)
at scala.tools.nsc.symtab.Symbols$Symbol.initialize
(Symbols.scala:624)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3040)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3360)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
(Typers.scala:1570)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.List$.loop$1(List.scala:293)
at scala.List$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate
(Typers.scala:1193)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef
(Typers.scala:1086)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3053)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3360)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
(Typers.scala:1570)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$19.apply
(Typers.scala:1615)
at scala.List$.loop$1(List.scala:293)
at scala.List$.mapConserve(List.scala:310)
at scala.List$.loop$1(List.scala:297)
at scala.List$.mapConserve(List.scala:310)
at scala.List$.loop$1(List.scala:297)
at scala.List$.mapConserve(List.scala:310)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats
(Typers.scala:1615)
at scala.tools.nsc.typechecker.Typers$Typer.typed1
(Typers.scala:3046)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3323)
at scala.tools.nsc.typechecker.Typers$Typer.typed
(Typers.scala:3360)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon
$2.apply(Analyzer.scala:40)
at scala.tools.nsc.Global$GlobalPhase.applyPhase
(Global.scala:268)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
(Global.scala:247)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
(Global.scala:247)
at scala.Iterator$class.foreach(Iterator.scala:410)
at scala.collection.mutable.ListBuffer$$anon$1.foreach
(ListBuffer.scala:266)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:247)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:579)
at scala.tools.nsc.Global$Run.compile(Global.scala:663)
at scala.tools.ant.Scalac.execute(Scalac.scala:574)
at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute
(Sequential.java:62)
at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute
(MacroInstance.java:394)
at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1189)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run
(BridgeImpl.java:273)
at org.apache.tools.ant.module.run.TargetExecutor.run
(TargetExecutor.java:499)
at org.netbeans.core.execution.RunClassThread.run
(RunClassThread.java:151)
/Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
impl.xml:401: The following error occurred while executing this line:
/Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
impl.xml:225: Compile failed because of an internal compiler error
(assertion failed); see the error output for details.
BUILD FAILED (total time: 3 seconds)
where the build-impl.xml reads in line 225
.... so what am i doing wrong? below is the source-code, a plain
translation from the java version that comes with kilim.
package scalaapplication1
import kilim._
class TimedTask extends Task {
@pausable
def execute {
println( "Task #" + id() + " going to sleep ..." )
Task.sleep( 2000 )
println( " Task #" + id() + " waking up" )
}
}
object Main extends Application {
override def main(args: Array[String]) = {
val numTasks = if( args.length > 0 ) Integer.parseInt(args
(0)) else 100
val exitmb= new Mailbox[ExitMsg]
for( i <- (0 until numTasks) ) {
new TimedTask.start.informOnExit( exitmb )
}
for( i <- (0 until numTasks) ) {
exitmb.getb
}
System.exit( 0 )
}
}
thanks for help! BTW, my general impression of the netbeans plugin
is good, it's not as fast as eclipse maybe, but it behaves a lot more
coherent, as far as i can tell. thanks for the work!
ciao, -sciss-
Fri, 2009-02-13, 14:17
#2
Re: Problem with adding Kilim (java lib) to my Scala netbeans p
is it that scala has problems with the bytecode-woven class files? or
a problem of handling the annotations of the kilim classes?
because... i put the same code in eclipse, and now "new Mailbox
[ExitMsg]" is swallowed without problems, but the line
exitmb.getb
produces the error "getb is not a member of Mailbox[ExitMsg]",
although getb is definitely there:
public T getb() {
return getb(0);
}
??? more confused....
ciao, -sciss-
Am 13.02.2009 um 13:41 schrieb Sciss:
> hi,
>
> i'm trying to use kilim with scala and i cannot get a proper
> compile. this might be due to me being new with the netbeans
> plugin... first is, i put all kilim classes into a kilim.jar that i
> copied into my netbeans project folder and added it to the
> Libraries tree, so it shows up in the project properties in the
> libraries category under "Compile-time Libraries". still the
> netbeans plugin complains about the "import kilim._" line, saying
> that this symbol was not found.
>
> ok, so i copied kilim.jar to my system wide class path /Library/
> Extensions/Java and relaunched netbeans, fine, no more errors
> showing up in the editor. but when i press Run, the compilation
> fails with
>
> Compiling 1 source file to /Users/rutz/Documents/netbeans/
> ScalaApplication1/build/classes
> java.lang.AssertionError: assertion failed
> at scala.Predef$.assert(Predef.scala:87)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.arrayToRepeated
> (ClassfileParser.scala:514)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod
> (ClassfileParser.scala:503)
> at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
> $parseClass$2.apply(ClassfileParser.scala:410)
> at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
> $parseClass$2.apply(ClassfileParser.scala:410)
> at scala.Range.foreach(Range.scala:44)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass
> (ClassfileParser.scala:410)
> at scala.tools.nsc.symtab.classfile.ClassfileParser.parse
> (ClassfileParser.scala:86)
> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
> at scala.tools.nsc.symtab.SymbolLoaders.completeClassfile
> (SymbolLoaders.scala:276)
> at scala.tools.nsc.symtab.SymbolLoaders
> $ClassfileLoader.doComplete(SymbolLoaders.scala:289)
> at scala.tools.nsc.symtab.SymbolLoaders
> $SymbolLoader.complete(SymbolLoaders.scala:77)
> at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load
> (SymbolLoaders.scala:97)
> at scala.tools.nsc.symtab.Symbols$Symbol.exists
> (Symbols.scala:387)
> at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1
> (Typers.scala:2902)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3252)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedAppliedTypeTree$1(Typers.scala:2992)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3276)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedTypeConstructor(Typers.scala:3411)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedTypeConstructor(Typers.scala:3419)
> at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1
> (Typers.scala:2425)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3155)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier
> (Typers.scala:3380)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3240)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $typedApply$1$1.apply(Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $typedApply$1$1.apply(Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer.silent
> (Typers.scala:583)
> at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1
> (Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3219)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3371)
> at scala.tools.nsc.typechecker.Typers$Typer.computeType
> (Typers.scala:3422)
> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
> (Namers.scala:859)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:415)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:413)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
> (Namers.scala:982)
> at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
> 510)
> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
> (Symbols.scala:624)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3040)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typedBlock
> (Typers.scala:1404)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3083)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3371)
> at scala.tools.nsc.typechecker.Typers$Typer.computeType
> (Typers.scala:3422)
> at scala.tools.nsc.typechecker.Namers$Namer.methodSig
> (Namers.scala:759)
> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
> (Namers.scala:848)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:415)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:413)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
> (Namers.scala:982)
> at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
> 510)
> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
> (Symbols.scala:624)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3040)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate
> (Typers.scala:1193)
> at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef
> (Typers.scala:1086)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3053)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3046)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon
> $2.apply(Analyzer.scala:40)
> at scala.tools.nsc.Global$GlobalPhase.applyPhase
> (Global.scala:268)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
> (Global.scala:247)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
> (Global.scala:247)
> at scala.Iterator$class.foreach(Iterator.scala:410)
> at scala.collection.mutable.ListBuffer$$anon$1.foreach
> (ListBuffer.scala:266)
> at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:247)
> at scala.tools.nsc.Global$Run.compileSources(Global.scala:579)
> at scala.tools.nsc.Global$Run.compile(Global.scala:663)
> at scala.tools.ant.Scalac.execute(Scalac.scala:574)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.taskdefs.Sequential.execute
> (Sequential.java:62)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.taskdefs.MacroInstance.execute
> (MacroInstance.java:394)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:357)
> at org.apache.tools.ant.Target.performTasks(Target.java:385)
> at org.apache.tools.ant.Project.executeSortedTargets
> (Project.java:1337)
> at org.apache.tools.ant.Project.executeTarget(Project.java:
> 1306)
> at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> (DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:
> 1189)
> at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run
> (BridgeImpl.java:273)
> at org.apache.tools.ant.module.run.TargetExecutor.run
> (TargetExecutor.java:499)
> at org.netbeans.core.execution.RunClassThread.run
> (RunClassThread.java:151)
> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
> impl.xml:401: The following error occurred while executing this line:
> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
> impl.xml:225: Compile failed because of an internal compiler error
> (assertion failed); see the error output for details.
> BUILD FAILED (total time: 3 seconds)
>
>
> where the build-impl.xml reads in line 225
>
> {destdir}" encoding="${source.encoding}" excludes="@{excludes}"
> includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@
> {srcdir}" target="jvm-${javac.target}">
>
>
> .... so what am i doing wrong? below is the source-code, a plain
> translation from the java version that comes with kilim.
>
>
> package scalaapplication1
>
> import kilim._
>
> class TimedTask extends Task {
> @pausable
> def execute {
> println( "Task #" + id() + " going to sleep ..." )
> Task.sleep( 2000 )
> println( " Task #" + id() + " waking up" )
> }
> }
>
> object Main extends Application {
> override def main(args: Array[String]) = {
> val numTasks = if( args.length > 0 ) Integer.parseInt(args
> (0)) else 100
> val exitmb= new Mailbox[ExitMsg]
>
> for( i <- (0 until numTasks) ) {
> new TimedTask.start.informOnExit( exitmb )
> }
>
> for( i <- (0 until numTasks) ) {
> exitmb.getb
> }
>
> System.exit( 0 )
> }
> }
>
>
> thanks for help! BTW, my general impression of the netbeans plugin
> is good, it's not as fast as eclipse maybe, but it behaves a lot
> more coherent, as far as i can tell. thanks for the work!
>
> ciao, -sciss-
>
>
Fri, 2009-02-13, 14:27
#3
Re: Problem with adding Kilim (java lib) to my Scala netbeans p
ok, the problem was that scalac and neither the eclipse nor netbeans
plugin can work with kilim.jar if it was woven.... ;-( so i can put
the unwoven classes in the classpath, compile, and then i guess i
will need to run the weaver both on my project and the kilim.jar....
ciao, -sciss-
Am 13.02.2009 um 14:06 schrieb Sciss:
> is it that scala has problems with the bytecode-woven class files?
> or a problem of handling the annotations of the kilim classes?
>
> because... i put the same code in eclipse, and now "new Mailbox
> [ExitMsg]" is swallowed without problems, but the line
>
> exitmb.getb
>
> produces the error "getb is not a member of Mailbox[ExitMsg]",
> although getb is definitely there:
>
> public T getb() {
> return getb(0);
> }
>
> ??? more confused....
>
> ciao, -sciss-
>
>
>
> Am 13.02.2009 um 13:41 schrieb Sciss:
>
>> hi,
>>
>> i'm trying to use kilim with scala and i cannot get a proper
>> compile. this might be due to me being new with the netbeans
>> plugin... first is, i put all kilim classes into a kilim.jar that
>> i copied into my netbeans project folder and added it to the
>> Libraries tree, so it shows up in the project properties in the
>> libraries category under "Compile-time Libraries". still the
>> netbeans plugin complains about the "import kilim._" line, saying
>> that this symbol was not found.
>>
>> ok, so i copied kilim.jar to my system wide class path /Library/
>> Extensions/Java and relaunched netbeans, fine, no more errors
>> showing up in the editor. but when i press Run, the compilation
>> fails with
>>
>> Compiling 1 source file to /Users/rutz/Documents/netbeans/
>> ScalaApplication1/build/classes
>> java.lang.AssertionError: assertion failed
>> at scala.Predef$.assert(Predef.scala:87)
>> at
>> scala.tools.nsc.symtab.classfile.ClassfileParser.arrayToRepeated
>> (ClassfileParser.scala:514)
>> at
>> scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod
>> (ClassfileParser.scala:503)
>> at scala.tools.nsc.symtab.classfile.ClassfileParser$
>> $anonfun$parseClass$2.apply(ClassfileParser.scala:410)
>> at scala.tools.nsc.symtab.classfile.ClassfileParser$
>> $anonfun$parseClass$2.apply(ClassfileParser.scala:410)
>> at scala.Range.foreach(Range.scala:44)
>> at
>> scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass
>> (ClassfileParser.scala:410)
>> at scala.tools.nsc.symtab.classfile.ClassfileParser.parse
>> (ClassfileParser.scala:86)
>> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
>> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
>> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
>> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
>> at scala.tools.nsc.symtab.SymbolLoaders.completeClassfile
>> (SymbolLoaders.scala:276)
>> at scala.tools.nsc.symtab.SymbolLoaders
>> $ClassfileLoader.doComplete(SymbolLoaders.scala:289)
>> at scala.tools.nsc.symtab.SymbolLoaders
>> $SymbolLoader.complete(SymbolLoaders.scala:77)
>> at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load
>> (SymbolLoaders.scala:97)
>> at scala.tools.nsc.symtab.Symbols$Symbol.exists
>> (Symbols.scala:387)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1
>> (Typers.scala:2902)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3252)
>> at scala.tools.nsc.typechecker.Typers
>> $Typer.typedAppliedTypeTree$1(Typers.scala:2992)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3276)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers
>> $Typer.typedTypeConstructor(Typers.scala:3411)
>> at scala.tools.nsc.typechecker.Typers
>> $Typer.typedTypeConstructor(Typers.scala:3419)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1
>> (Typers.scala:2425)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3155)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier
>> (Typers.scala:3380)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3240)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $typedApply$1$1.apply(Typers.scala:2607)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $typedApply$1$1.apply(Typers.scala:2607)
>> at scala.tools.nsc.typechecker.Typers$Typer.silent
>> (Typers.scala:583)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1
>> (Typers.scala:2607)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3219)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3371)
>> at scala.tools.nsc.typechecker.Typers$Typer.computeType
>> (Typers.scala:3422)
>> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
>> (Namers.scala:859)
>> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
>> $typeCompleter$1.apply(Namers.scala:415)
>> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
>> $typeCompleter$1.apply(Namers.scala:413)
>> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
>> (Namers.scala:982)
>> at scala.tools.nsc.symtab.Symbols$Symbol.info
>> (Symbols.scala:510)
>> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
>> (Symbols.scala:624)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3040)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3360)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
>> (Typers.scala:1570)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.List$.loop$1(List.scala:293)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.List$.loop$1(List.scala:297)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
>> (Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedBlock
>> (Typers.scala:1404)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3083)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3371)
>> at scala.tools.nsc.typechecker.Typers$Typer.computeType
>> (Typers.scala:3422)
>> at scala.tools.nsc.typechecker.Namers$Namer.methodSig
>> (Namers.scala:759)
>> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
>> (Namers.scala:848)
>> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
>> $typeCompleter$1.apply(Namers.scala:415)
>> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
>> $typeCompleter$1.apply(Namers.scala:413)
>> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
>> (Namers.scala:982)
>> at scala.tools.nsc.symtab.Symbols$Symbol.info
>> (Symbols.scala:510)
>> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
>> (Symbols.scala:624)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3040)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3360)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
>> (Typers.scala:1570)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.List$.loop$1(List.scala:293)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
>> (Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate
>> (Typers.scala:1193)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef
>> (Typers.scala:1086)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3053)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3360)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
>> (Typers.scala:1570)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
>> $19.apply(Typers.scala:1615)
>> at scala.List$.loop$1(List.scala:293)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.List$.loop$1(List.scala:297)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.List$.loop$1(List.scala:297)
>> at scala.List$.mapConserve(List.scala:310)
>> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
>> (Typers.scala:1615)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed1
>> (Typers.scala:3046)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3323)
>> at scala.tools.nsc.typechecker.Typers$Typer.typed
>> (Typers.scala:3360)
>> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon
>> $2.apply(Analyzer.scala:40)
>> at scala.tools.nsc.Global$GlobalPhase.applyPhase
>> (Global.scala:268)
>> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
>> (Global.scala:247)
>> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
>> (Global.scala:247)
>> at scala.Iterator$class.foreach(Iterator.scala:410)
>> at scala.collection.mutable.ListBuffer$$anon$1.foreach
>> (ListBuffer.scala:266)
>> at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:247)
>> at scala.tools.nsc.Global$Run.compileSources(Global.scala:
>> 579)
>> at scala.tools.nsc.Global$Run.compile(Global.scala:663)
>> at scala.tools.ant.Scalac.execute(Scalac.scala:574)
>> at org.apache.tools.ant.UnknownElement.execute
>> (UnknownElement.java:288)
>> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
>> Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at org.apache.tools.ant.dispatch.DispatchUtils.execute
>> (DispatchUtils.java:106)
>> at org.apache.tools.ant.Task.perform(Task.java:348)
>> at org.apache.tools.ant.taskdefs.Sequential.execute
>> (Sequential.java:62)
>> at org.apache.tools.ant.UnknownElement.execute
>> (UnknownElement.java:288)
>> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
>> Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at org.apache.tools.ant.dispatch.DispatchUtils.execute
>> (DispatchUtils.java:106)
>> at org.apache.tools.ant.Task.perform(Task.java:348)
>> at org.apache.tools.ant.taskdefs.MacroInstance.execute
>> (MacroInstance.java:394)
>> at org.apache.tools.ant.UnknownElement.execute
>> (UnknownElement.java:288)
>> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
>> Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at org.apache.tools.ant.dispatch.DispatchUtils.execute
>> (DispatchUtils.java:106)
>> at org.apache.tools.ant.Task.perform(Task.java:348)
>> at org.apache.tools.ant.Target.execute(Target.java:357)
>> at org.apache.tools.ant.Target.performTasks(Target.java:385)
>> at org.apache.tools.ant.Project.executeSortedTargets
>> (Project.java:1337)
>> at org.apache.tools.ant.Project.executeTarget(Project.java:
>> 1306)
>> at
>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets
>> (DefaultExecutor.java:41)
>> at org.apache.tools.ant.Project.executeTargets
>> (Project.java:1189)
>> at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run
>> (BridgeImpl.java:273)
>> at org.apache.tools.ant.module.run.TargetExecutor.run
>> (TargetExecutor.java:499)
>> at org.netbeans.core.execution.RunClassThread.run
>> (RunClassThread.java:151)
>> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
>> impl.xml:401: The following error occurred while executing this line:
>> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
>> impl.xml:225: Compile failed because of an internal compiler error
>> (assertion failed); see the error output for details.
>> BUILD FAILED (total time: 3 seconds)
>>
>>
>> where the build-impl.xml reads in line 225
>>
>> > {destdir}" encoding="${source.encoding}" excludes="@{excludes}"
>> includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@
>> {srcdir}" target="jvm-${javac.target}">
>>
>>
>> .... so what am i doing wrong? below is the source-code, a plain
>> translation from the java version that comes with kilim.
>>
>>
>> package scalaapplication1
>>
>> import kilim._
>>
>> class TimedTask extends Task {
>> @pausable
>> def execute {
>> println( "Task #" + id() + " going to sleep ..." )
>> Task.sleep( 2000 )
>> println( " Task #" + id() + " waking up" )
>> }
>> }
>>
>> object Main extends Application {
>> override def main(args: Array[String]) = {
>> val numTasks = if( args.length > 0 ) Integer.parseInt(args
>> (0)) else 100
>> val exitmb= new Mailbox[ExitMsg]
>>
>> for( i <- (0 until numTasks) ) {
>> new TimedTask.start.informOnExit( exitmb )
>> }
>>
>> for( i <- (0 until numTasks) ) {
>> exitmb.getb
>> }
>>
>> System.exit( 0 )
>> }
>> }
>>
>>
>> thanks for help! BTW, my general impression of the netbeans
>> plugin is good, it's not as fast as eclipse maybe, but it behaves
>> a lot more coherent, as far as i can tell. thanks for the work!
>>
>> ciao, -sciss-
>>
>>
>
Fri, 2009-02-13, 15:27
#4
Re: Problem with adding Kilim (java lib) to my Scala netbeans p
Hi,
just wanted to point out a potential problem when using Kilim with Scala:
Kilim requires all pausable methods to be annotated with @pausable. As a
consequence, you can't pause if the current call chain contains a method
whose source code isn't under your control (unless you resort to bytecode
manipulation or patch Kilim's weaver). With Scala's higher-order functions
and function literals, you get into this situation very quickly. For
example, you can't pause within the following code:
list.filter(x => /* can't pause here */ )
for (i <- 0 to 2) { /* can't pause here */ }
myControlAbstraction { /* can't pause here */ }
This is a pretty drastic limitation and one of the reasons why I couldn't
make the switch from JavaFlow to Kilim. (To be clear, these problems don't
all go away with JavaFlow, but you get more possibilities to work around
them.)
Cheers,
Peter
Fri, 2009-02-13, 15:37
#5
Re: Problem with adding Kilim (java lib) to my Scala netbeans p
doh, thanks for pointing this out. this is very sad indeed. how would
you work around this in javaflow?
with kilim, could i work around this with a tiny helper case class like
for( i <- 0 to 2 ) P({ /* can pause here? /* })
?
or could one add the @pausable annotation to some function class of
scala?
-sciss-
Am 13.02.2009 um 15:15 schrieb Peter Niederwieser:
>
> Hi,
>
> just wanted to point out a potential problem when using Kilim with
> Scala:
> Kilim requires all pausable methods to be annotated with @pausable.
> As a
> consequence, you can't pause if the current call chain contains a
> method
> whose source code isn't under your control (unless you resort to
> bytecode
> manipulation or patch Kilim's weaver). With Scala's higher-order
> functions
> and function literals, you get into this situation very quickly. For
> example, you can't pause within the following code:
>
> list.filter(x => /* can't pause here */ )
> for (i <- 0 to 2) { /* can't pause here */ }
> myControlAbstraction { /* can't pause here */ }
>
> This is a pretty drastic limitation and one of the reasons why I
> couldn't
> make the switch from JavaFlow to Kilim. (To be clear, these
> problems don't
> all go away with JavaFlow, but you get more possibilities to work
> around
> them.)
>
> Cheers,
> Peter
>
Fri, 2009-02-13, 16:37
#6
Re: Problem with adding Kilim (java lib) to my Scala netbeans p
Sciss-3 wrote:
>
> doh, thanks for pointing this out. this is very sad indeed. how would
> you work around this in javaflow?
>
There are two possibilities:
1. Use load-time weaving (custom class loader provided by JavaFlow)
This should make all code pausable, but at the cost of CPS-transforming too
many classes. Hence performance will suffer and the chance of hitting a
bug/limitation of JavaFlow will increase (keep in mind that JavaFlow never
got to an official release and is no longer being worked on). Also,
depending on your environment, a custom class loader might not be a viable
option.
2. Use compile-time weaving
Here you need to tell the JavaFlow Ant target or JavaFlow API which class
files should be transformed. This makes it relatively easy to transform
function literals appearing in your own code. For example, the Ant pattern
Foo*.class will (among others) match all function literals in Foo.
Transforming third-party code is possible but not so nice, because you will
have to fiddle with third-party Jars. Also you might end up transforming
many classes (think scala-runtime.jar - where do you stop?), leading to the
problems mentioned above.
Sciss-3 wrote:
>
> with kilim, could i work around this with a tiny helper case class like
> for( i <- 0 to 2 ) P({ /* can pause here? /* })
>
I don't think so, because the apply() method of the generated Function class
is still not @pausable.
Sciss-3 wrote:
>
> or could one add the @pausable annotation to some function class of
> scala?
>
I'm afraid @pausable won't make it into the Scala class library. :-) You
could implement your own pausable Function classes, but this still won't let
you use function literals.
Cheers,
Peter
Fri, 2009-02-13, 17:37
#7
Re: Problem with adding Kilim (java lib) to my Scala netbeans
def pausable[A,B](f : A => B) : A => B = new Function1[A,B] {
@pausable
def apply(arg : A) = f(arg)
}
Stream from 1 filter pausable(_ > 1)
On Fri, Feb 13, 2009 at 7:30 AM, Peter Niederwieser <pniederw@gmail.com> wrote:
Sciss-3 wrote:
>
> doh, thanks for pointing this out. this is very sad indeed. how would
> you work around this in javaflow?
>
There are two possibilities:
1. Use load-time weaving (custom class loader provided by JavaFlow)
This should make all code pausable, but at the cost of CPS-transforming too
many classes. Hence performance will suffer and the chance of hitting a
bug/limitation of JavaFlow will increase (keep in mind that JavaFlow never
got to an official release and is no longer being worked on). Also,
depending on your environment, a custom class loader might not be a viable
option.
2. Use compile-time weaving
Here you need to tell the JavaFlow Ant target or JavaFlow API which class
files should be transformed. This makes it relatively easy to transform
function literals appearing in your own code. For example, the Ant pattern
Foo*.class will (among others) match all function literals in Foo.
Transforming third-party code is possible but not so nice, because you will
have to fiddle with third-party Jars. Also you might end up transforming
many classes (think scala-runtime.jar - where do you stop?), leading to the
problems mentioned above.
Sciss-3 wrote:
>
> with kilim, could i work around this with a tiny helper case class like
> for( i <- 0 to 2 ) P({ /* can pause here? /* })
>
I don't think so, because the apply() method of the generated Function class
is still not @pausable.
Sciss-3 wrote:
>
> or could one add the @pausable annotation to some function class of
> scala?
>
I'm afraid @pausable won't make it into the Scala class library. :-) You
could implement your own pausable Function classes, but this still won't let
you use function literals.
Cheers,
Peter
--
View this message in context: http://www.nabble.com/-scala-tools--Problem-with-adding-Kilim-%28java-lib%29-to-my-Scala-netbeans-project-tp21995582p21998618.html
Sent from the Scala - Tools mailing list archive at Nabble.com.
Fri, 2009-02-13, 18:47
#8
Re: Problem with adding Kilim (java lib) to my Scala netbeans
James Iry-2 wrote:
>
> def pausable[A,B](f : A => B) : A => B = new Function1[A,B] {
> @pausable
> def apply(arg : A) = f(arg)
> }
>
> Stream from 1 filter pausable(_ > 1)
>
I don't think this will help, because f.apply() is still not
CPS-transformed.
Cheers,
Peter
Sat, 2009-02-14, 12:27
#9
Re: Problem with adding Kilim (java lib) to my Scala netbeans
Why not alter it in the Scala source and build your own Scala?
2009/2/13 Peter Niederwieser :
>
>
> James Iry-2 wrote:
>>
>> def pausable[A,B](f : A => B) : A => B = new Function1[A,B] {
>> @pausable
>> def apply(arg : A) = f(arg)
>> }
>>
>> Stream from 1 filter pausable(_ > 1)
>>
>
> I don't think this will help, because f.apply() is still not
> CPS-transformed.
>
> Cheers,
> Peter
> --
> View this message in context: http://www.nabble.com/-scala-tools--Problem-with-adding-Kilim-%28java-li...
> Sent from the Scala - Tools mailing list archive at Nabble.com.
>
>
it is this line that causes the problem
val exitmb = new Mailbox[ExitMsg]
if i remove it (and comment out the references to exitmb) it
compiles. very weird...
Am 13.02.2009 um 13:41 schrieb Sciss:
> hi,
>
> i'm trying to use kilim with scala and i cannot get a proper
> compile. this might be due to me being new with the netbeans
> plugin... first is, i put all kilim classes into a kilim.jar that i
> copied into my netbeans project folder and added it to the
> Libraries tree, so it shows up in the project properties in the
> libraries category under "Compile-time Libraries". still the
> netbeans plugin complains about the "import kilim._" line, saying
> that this symbol was not found.
>
> ok, so i copied kilim.jar to my system wide class path /Library/
> Extensions/Java and relaunched netbeans, fine, no more errors
> showing up in the editor. but when i press Run, the compilation
> fails with
>
> Compiling 1 source file to /Users/rutz/Documents/netbeans/
> ScalaApplication1/build/classes
> java.lang.AssertionError: assertion failed
> at scala.Predef$.assert(Predef.scala:87)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.arrayToRepeated
> (ClassfileParser.scala:514)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod
> (ClassfileParser.scala:503)
> at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
> $parseClass$2.apply(ClassfileParser.scala:410)
> at scala.tools.nsc.symtab.classfile.ClassfileParser$$anonfun
> $parseClass$2.apply(ClassfileParser.scala:410)
> at scala.Range.foreach(Range.scala:44)
> at
> scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass
> (ClassfileParser.scala:410)
> at scala.tools.nsc.symtab.classfile.ClassfileParser.parse
> (ClassfileParser.scala:86)
> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
> at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader$
> $anonfun$doComplete$3.apply(SymbolLoaders.scala:290)
> at scala.tools.nsc.symtab.SymbolLoaders.completeClassfile
> (SymbolLoaders.scala:276)
> at scala.tools.nsc.symtab.SymbolLoaders
> $ClassfileLoader.doComplete(SymbolLoaders.scala:289)
> at scala.tools.nsc.symtab.SymbolLoaders
> $SymbolLoader.complete(SymbolLoaders.scala:77)
> at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load
> (SymbolLoaders.scala:97)
> at scala.tools.nsc.symtab.Symbols$Symbol.exists
> (Symbols.scala:387)
> at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1
> (Typers.scala:2902)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3252)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedAppliedTypeTree$1(Typers.scala:2992)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3276)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedTypeConstructor(Typers.scala:3411)
> at scala.tools.nsc.typechecker.Typers
> $Typer.typedTypeConstructor(Typers.scala:3419)
> at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1
> (Typers.scala:2425)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3155)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier
> (Typers.scala:3380)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3240)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $typedApply$1$1.apply(Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $typedApply$1$1.apply(Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer.silent
> (Typers.scala:583)
> at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1
> (Typers.scala:2607)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3219)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3371)
> at scala.tools.nsc.typechecker.Typers$Typer.computeType
> (Typers.scala:3422)
> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
> (Namers.scala:859)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:415)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:413)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
> (Namers.scala:982)
> at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
> 510)
> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
> (Symbols.scala:624)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3040)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typedBlock
> (Typers.scala:1404)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3083)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3371)
> at scala.tools.nsc.typechecker.Typers$Typer.computeType
> (Typers.scala:3422)
> at scala.tools.nsc.typechecker.Namers$Namer.methodSig
> (Namers.scala:759)
> at scala.tools.nsc.typechecker.Namers$Namer.typeSig
> (Namers.scala:848)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:415)
> at scala.tools.nsc.typechecker.Namers$Namer$$anonfun
> $typeCompleter$1.apply(Namers.scala:413)
> at scala.tools.nsc.typechecker.Namers$$anon$1.complete
> (Namers.scala:982)
> at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:
> 510)
> at scala.tools.nsc.symtab.Symbols$Symbol.initialize
> (Symbols.scala:624)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3040)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate
> (Typers.scala:1193)
> at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef
> (Typers.scala:1086)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3053)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1
> (Typers.scala:1570)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer$$anonfun
> $19.apply(Typers.scala:1615)
> at scala.List$.loop$1(List.scala:293)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.List$.loop$1(List.scala:297)
> at scala.List$.mapConserve(List.scala:310)
> at scala.tools.nsc.typechecker.Typers$Typer.typedStats
> (Typers.scala:1615)
> at scala.tools.nsc.typechecker.Typers$Typer.typed1
> (Typers.scala:3046)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3323)
> at scala.tools.nsc.typechecker.Typers$Typer.typed
> (Typers.scala:3360)
> at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon
> $2.apply(Analyzer.scala:40)
> at scala.tools.nsc.Global$GlobalPhase.applyPhase
> (Global.scala:268)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
> (Global.scala:247)
> at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply
> (Global.scala:247)
> at scala.Iterator$class.foreach(Iterator.scala:410)
> at scala.collection.mutable.ListBuffer$$anon$1.foreach
> (ListBuffer.scala:266)
> at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:247)
> at scala.tools.nsc.Global$Run.compileSources(Global.scala:579)
> at scala.tools.nsc.Global$Run.compile(Global.scala:663)
> at scala.tools.ant.Scalac.execute(Scalac.scala:574)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.taskdefs.Sequential.execute
> (Sequential.java:62)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.taskdefs.MacroInstance.execute
> (MacroInstance.java:394)
> at org.apache.tools.ant.UnknownElement.execute
> (UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute
> (DispatchUtils.java:106)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:357)
> at org.apache.tools.ant.Target.performTasks(Target.java:385)
> at org.apache.tools.ant.Project.executeSortedTargets
> (Project.java:1337)
> at org.apache.tools.ant.Project.executeTarget(Project.java:
> 1306)
> at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets
> (DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:
> 1189)
> at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run
> (BridgeImpl.java:273)
> at org.apache.tools.ant.module.run.TargetExecutor.run
> (TargetExecutor.java:499)
> at org.netbeans.core.execution.RunClassThread.run
> (RunClassThread.java:151)
> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
> impl.xml:401: The following error occurred while executing this line:
> /Users/rutz/Documents/netbeans/ScalaApplication1/nbproject/build-
> impl.xml:225: Compile failed because of an internal compiler error
> (assertion failed); see the error output for details.
> BUILD FAILED (total time: 3 seconds)
>
>
> where the build-impl.xml reads in line 225
>
> {destdir}" encoding="${source.encoding}" excludes="@{excludes}"
> includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@
> {srcdir}" target="jvm-${javac.target}">
>
>
> .... so what am i doing wrong? below is the source-code, a plain
> translation from the java version that comes with kilim.
>
>
> package scalaapplication1
>
> import kilim._
>
> class TimedTask extends Task {
> @pausable
> def execute {
> println( "Task #" + id() + " going to sleep ..." )
> Task.sleep( 2000 )
> println( " Task #" + id() + " waking up" )
> }
> }
>
> object Main extends Application {
> override def main(args: Array[String]) = {
> val numTasks = if( args.length > 0 ) Integer.parseInt(args
> (0)) else 100
> val exitmb= new Mailbox[ExitMsg]
>
> for( i <- (0 until numTasks) ) {
> new TimedTask.start.informOnExit( exitmb )
> }
>
> for( i <- (0 until numTasks) ) {
> exitmb.getb
> }
>
> System.exit( 0 )
> }
> }
>
>
> thanks for help! BTW, my general impression of the netbeans plugin
> is good, it's not as fast as eclipse maybe, but it behaves a lot
> more coherent, as far as i can tell. thanks for the work!
>
> ciao, -sciss-
>
>