java.lang.VerifyError on RichInt

205 views
Skip to first unread message

Bill Atkins

unread,
May 13, 2011, 2:25:32 PM5/13/11
to scala-user
I just upgraded to Scala 2.9.0 (and the latest 2.9.0-compatible ScalaQuery). When I try to insert a row into a ScalaQuery-mapped table, I get the following error:

Exception in thread "main" java.lang.VerifyError: class scala.runtime.RichInt$$anon$2 overrides final method foreach.(Lscala/Function1;)V
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at scala.runtime.RichInt.until(RichInt.scala:25)
    at org.scalaquery.ql.basic.BasicInsertBuilder.f$1(BasicInsertBuilder.scala:32)
    ....

The snippet in ScalaQuery that causes this is in BasicInsertBuilder.scala:

      case p:Projection[_] =>
        for(i <- 0 until p.productArity)
          f(Node(p.productElement(i)))
 

but I don't see any problem there.

The RichInt.until implementation in question is a bridge method:

      @bridge
      def until(end: Int): Range with Range.ByOne = new Range(self, end, 1) with Range.ByOne

Does anyone know what would cause this? If this is more a ScalaQuery issue than a 2.9.0 issue, let me know and I can redirect my question to the ScalaQuery mailing list.

Thanks,
Bill

Paul Phillips

unread,
May 13, 2011, 2:32:48 PM5/13/11
to batk...@gmail.com, scala-user
On 5/13/11 11:25 AM, Bill Atkins wrote:
> I just upgraded to Scala 2.9.0 (and the latest 2.9.0-compatible
> ScalaQuery). When I try to insert a row into a ScalaQuery-mapped table,
> I get the following error:
>
> Exception in thread "main" java.lang.VerifyError: class
> scala.runtime.RichInt$$anon$2 overrides final method
> foreach.(Lscala/Function1;)V

https://lampsvn.epfl.ch/trac/scala/ticket/4575
"java.lang.VerifyError: class scala.runtime.RichInt$$anon$1 overrides final method foreach.(Lscala/Function1;)V"

Bill Atkins

unread,
May 13, 2011, 3:32:07 PM5/13/11
to Paul Phillips, scala-user
I see - thanks!

Robbie Coleman

unread,
May 18, 2011, 6:30:16 PM5/18/11
to scala...@googlegroups.com, batk...@gmail.com
Just to note that Scala moved from trac to jira so the link to the bug is now:
https://issues.scala-lang.org/browse/SI-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Looks like odersky has fixed this compiler bug, but I do not know if such a fix has been released. I am seeing the same runtime exception with Glassfish:


java.lang.VerifyError: class scala.runtime.RichInt$$anon$2 overrides final method foreach.(Lscala/Function1;)V
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:925)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1485)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
    at scala.runtime.RichInt.until(RichInt.scala:25)
    at net.liftweb.json.JsonAST$.quote(JsonAST.scala:397)
    at net.liftweb.json.JsonAST$.render(JsonAST.scala:363)
    at net.liftweb.json.JsonAST$$anonfun$3.apply(JsonAST.scala:367)
    at net.liftweb.json.JsonAST$$anonfun$3.apply(JsonAST.scala:367)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at net.liftweb.json.JsonAST$.render(JsonAST.scala:367)
    at net.liftweb.json.JsonAST$$anonfun$2.apply(JsonAST.scala:364)
    at net.liftweb.json.JsonAST$$anonfun$2.apply(JsonAST.scala:364)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at net.liftweb.json.JsonAST$.render(JsonAST.scala:364)
    at net.liftweb.json.JsonAST$$anonfun$3.apply(JsonAST.scala:367)
    at net.liftweb.json.JsonAST$$anonfun$3.apply(JsonAST.scala:367)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at net.liftweb.json.JsonAST$.render(JsonAST.scala:367)

Ismael Juma

unread,
May 19, 2011, 5:03:01 AM5/19/11
to scala...@googlegroups.com, batk...@gmail.com
Hi Robbie,

On Wed, May 18, 2011 at 11:30 PM, Robbie Coleman <rob...@robnrob.com> wrote:
> Looks like odersky has fixed this compiler bug, but I do not know if such a
> fix has been released. I am seeing the same runtime exception with
> Glassfish:

The bug was fixed in trunk, but no release includes it yet. What
version of Scala did you use?

Best,
Ismael

Robbie Coleman

unread,
May 19, 2011, 5:08:46 AM5/19/11
to scala...@googlegroups.com, batk...@gmail.com
I was using the full release of 2.9.0, but I do see issues with some of our dependencies like lift json and a couple others that have yet to release even a snapshot version built against 2.9.0.

Thanks for the update @Ismael.

Ismael Juma

unread,
May 19, 2011, 5:18:24 AM5/19/11
to scala...@googlegroups.com, batk...@gmail.com
On Thu, May 19, 2011 at 10:08 AM, Robbie Coleman <rob...@robnrob.com> wrote:
> I was using the full release of 2.9.0

That has the issue, so it's indeed expected to fail.

> but I do see issues with some of our
> dependencies like lift json and a couple others that have yet to release
> even a snapshot version built against 2.9.0.

lift-json has released a snapshot version built with 2.9.0 a couple of days ago.

Best,
Ismael

martin odersky

unread,
May 19, 2011, 11:12:12 AM5/19/11
to Ismael Juma, scala...@googlegroups.com, batk...@gmail.com
We will push out a maintenance release of 2.9 shortly that contains a fix for this problem as well as a couple of others.

 -- Martin
--
----------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967

Sue Hinton

unread,
Jul 20, 2011, 11:46:54 AM7/20/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com
FYI, just downloaded scala-2.9.0.1 and am getting
    java.lang.NoSuchMethodError: scala.runtime.RichInt.until(I)Lscala/collection/immutable/Range$ByOne;
    at Main$$anon$1$$anonfun$2$$anonfun$apply$4.apply(OverallDelayInfo.scala:112)
at the for-loop line below

        val in = new java.io.FileInputStream(file)
        var lines = Source.fromInputStream(in).getLines.toArray
        //println(file.getName + " has " + lines.length + " lines.")
        in.close
 
        val inHeaderRow = lines(0).split(",")

       for(i <- 0 until inHeaderRow.length)  // exception is thrown at this line

... So I'm reverting to 2.8.0.final.

Naftoli Gugenheim

unread,
Jul 21, 2011, 12:49:44 AM7/21/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com
Did you do a clean build?

Sue Hinton

unread,
Jul 21, 2011, 5:27:45 PM7/21/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com
My code "build" should be clean, as I use a commandline scripting mechanism to run, i.e.,
>  scala MyScript.scala <input params>

The build of scala was downloaded from the web into its own directory, and is used exclusively, so it should be clean.

James Moore

unread,
Nov 9, 2011, 3:16:39 AM11/9/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com
I think I'm seeing the same thing with 2.9.1 and 2.9.2.  The error I get is:

(using scala-2.9.2.r25964-b20111108042542)
[error] (run-main) java.lang.VerifyError: class com.restphone.IsList$ overrides final method canEqual.(Ljava/lang/Object;)Z
java.lang.VerifyError: class com.restphone.IsList$ overrides final method canEqual.(Ljava/lang/Object;)Z
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

If I rebuild with scala-2.10.0.r25972-b20111109023956 I don't see the problem.

James Moore

unread,
Nov 9, 2011, 3:26:20 AM11/9/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com

Code at  https://s3.amazonaws.com/teenstarter/Deleteme3.tar.bz2.  It should run with sbt run.  (Warning: the project isn't finished, readable code.  It's a project that I use as a scratch area for experiments.  However, it should repro the stack dump repeatably.)

James Moore

unread,
Nov 9, 2011, 12:39:31 PM11/9/11
to scala...@googlegroups.com, Ismael Juma, batk...@gmail.com
Reply all
Reply to author
Forward
0 new messages