Re: weird error

8 views
Skip to first unread message

Bill Venners

unread,
Mar 12, 2009, 2:53:30 AM3/12/09
to Vlad Patryshev, scalate...@googlegroups.com
Hi Vlad,

I think I have an answer for your issue report here:

https://scalatest.dev.java.net/issues/show_bug.cgi?id=1

I suspect the problem may be a typo in the name of the JUnit Jar file,
or some other problem with that Jar file. I went to junit.org and
downloaded three versions. They had these names:

junit-4.3.1.jar
junit-4.4.jar
junit-4.5.jar

When I compile without a JUnit Jar file (or have a typo in the name),
I get the same error message you get:

bob-vaio:scalatest-0.9.5 bv$ scalac -classpath
scalatest-0.9.5.jar:../../st/lib/ScalaCheck-1.5.jar StackSuite.scala
Exception in thread "main" java.lang.RuntimeException: malformed Scala
signature of JUnit3Suite at 934; reference value junit of package
<root> refers to nonexisting symbol.
at scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.errorBadSignature(UnPickler.scala:762)
at scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.scala$tools$nsc$symtab$classfile$UnPickler$UnPickle$$readSymbol(UnPickler.scala:172)

But when I compile with any of these three JUnit Jar files correctly
included in the classpath, it compiles fine. I also tried running with
all three versions, and they run fine too. Can you double check the
spelling of the name of your JAR file, and if it is correct, try going
to junit.org and downloading one of the official releases? It may be
that the eclipse Jar file you're using may have stripped the old junit
stuff out, which JUnit3Suite uses. (When JUnit went from 3 to 4, the
package name went from "junit...." to "org.junit..." The name
org.junit4_4.3.1 in the eclipse plugins directory makes me think that
you're just not using a full or complete JUnit Jar file.)

Please let me know if this resolves your issue.

Thanks.

Bill

C:\Users\vpatryshev\cat\scala>scalac -classpath \Users\vpatryshev\scala\scalates
t-0.9.5\scalatest-0.9.5.jar;\Users\vpatryshev\eclipse\plugins\org.junit4_4.3.1;l
ib/ScalaCheck-1.5.jar\junit.jar tests/math/cat/SetsTest.scala

The version of scalac is 2.7.3.final; java is 1.6.0_11


On Fri, Mar 6, 2009 at 12:21 PM, Vlad Patryshev <vpatr...@gmail.com> wrote:
> Bill,
> I've got a feeling something might be wrong with the jar file: I'm getting
> this:
> Exception in thread "main" java.lang.RuntimeException: malformed Scala
> signature
>  of JUnit3Suite at 934; reference value junit of package <root> refers to
> nonexi
> sting symbol.
>         at
> scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.errorBadSignature
> (UnPickler.scala:762)
>         at
> scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.scala$tools$nsc$s
> ymtab$classfile$UnPickler$UnPickle$$readSymbol(UnPickler.scala:172)
>         at
> scala.tools.nsc.symtab.classfile.UnPickler$UnPickle$$anonfun$scala$to
> ols$nsc$symtab$classfile$UnPickler$UnPickle$$readSymbolRef$1.apply(UnPickler.sca
> la:714)
>         at
> scala.tools.nsc.symtab.classfile.UnPickler$UnPickle$$anonfun$scala$to
> ols$nsc$symtab$classfile$UnPickler$UnPickle$$readSymbolRef$1.apply(UnPickler.sca
> la:714)
>         at
> scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.scala$tools$nsc$s
> ymtab$classfile$UnPickler$UnPickle$$at(UnPickler.scala:139)
> When I run
> scalac -classpath
> \Users\vpatryshev\scala\scalatest-0.9.5\scalatest-0.9.5.jar -d bin
> tests/math/cat/SetsTest.scala
>
> and the file (I guess its content does not matter, but still) is this:
> package math.cat
> import org.scalatest.junit.JUnit3Suite
> import math.cat.Sets._
> class StackSuite extends JUnit3Suite with Checkers {
>   def testPopsInLifoOrder() {
>     val stack = new Stack[Int]
>     stack.push(1)
>     stack.push(2)
>     assert(stack.pop() === (2))
>     assert(stack.pop() === (1))
>   }
>   def testIsEmptyWhenCreated() {
>     val stack = new Stack[Int]
>     assert(stack.isEmpty)
>   }
>   def testElementsHasAllObjectsPushedInOrder() { // uses a ScalaCheck
> property check
>     check(
>       (list: List[Int]) => {
>         val stack = new Stack[Int]
>         for (element <- list) stack.push(element)
>         stack.elements.toList == list
>       }
>     )
>   }
> }
> (I've copied over your example, just to see if it works)
> --
> Thanks,
> -Vlad
>

Reply all
Reply to author
Forward
0 new messages