Using a Scala symbol literal results in NoSuchMethod
Posted
by Benson
on Stack Overflow
See other posts from Stack Overflow
or by Benson
Published on 2010-05-19T05:30:21Z
Indexed on
2010/05/19
13:20 UTC
Read the original article
Hit count: 420
I have recently begun using Scala. I've written a DSL in it which can be used to describe a processing pipeline in medici. In my DSL, I've made use of symbols to signify an anchor, which can be used to put a fork (or a tee, if you prefer) in the pipeline. Here's a small sample program that runs correctly:
object Test extends PipelineBuilder {
connector("TCP") / Map("tcpProtocol" -> new DirectProtocol())
"tcp://localhost:4858" --> "ByteToStringProcessor" --> Symbol("hello")
"stdio://in?promptMessage=enter name:%20" --> Symbol("hello")
Symbol("hello") --> "SayHello" / Map("prefix" -> "\n\t") --> "stdio://out"
}
For some reason, when I use a symbol literal in my program, I get a NoSuchMethod exception at runtime:
java.lang.NoSuchMethodError: scala.Symbol.intern()Lscala/Symbol;
at gov.pnnl.mif.scaladsl.Test$.<init>(Test.scala:7)
at gov.pnnl.mif.scaladsl.Test$.<clinit>(Test.scala)
at gov.pnnl.mif.scaladsl.Test.main(Test.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.ObjectRunner$$anonfun$run$1.apply(ObjectRunner.scala:75)
at scala.tools.nsc.ObjectRunner$.withContextClassLoader(ObjectRunner.scala:49)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:74)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:154)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
This happens regardless of how the symbol is used. Specifically, I've tried using the symbol in the pipeline, and in a simple println('foo)
statement.
The question: What could possibly cause a symbol literal's mere existence to cause a NoSuchMethodError? In my DSL I am using an implicit function which converts symbols to instances of the Anchor class, like so:
implicit def makeAnchor(a: Symbol):Anchor = anchor(a)
Sadly, my understanding of Scala is weak enough that I can't think of why that might be causing my NoSuchMethodError.
© Stack Overflow or respective owner