This page is no longer maintained — Please continue to the home page at www.scala-lang.org

java.lang.VerifyError on RichInt

13 replies
Bill Atkins
Joined: 2011-05-10,
User offline. Last seen 42 years 45 weeks ago.
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
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: java.lang.VerifyError on RichInt

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
Joined: 2011-05-10,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
I see - thanks!

Paul Phillips wrote:
4DCD7950 [dot] 8080702 [at] improving [dot] org" type="cite">
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"
Robbie Coleman
Joined: 2011-05-18,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
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 2
Joined: 2011-01-22,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt

Hi Robbie,

On Wed, May 18, 2011 at 11:30 PM, Robbie Coleman 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
Joined: 2011-05-18,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
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 2
Joined: 2011-01-22,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt

On Thu, May 19, 2011 at 10:08 AM, Robbie Coleman 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

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: java.lang.VerifyError on RichInt
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

On Thu, May 19, 2011 at 11:18 AM, Ismael Juma <ismael [at] juma [dot] me [dot] uk> wrote:
On Thu, May 19, 2011 at 10:08 AM, Robbie Coleman <robbie [at] robnrob [dot] 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
Prof., EPFL and CEO, Typesafe
PSED, 1015 Lausanne, Switzerland
Tel. EPFL: +41 21 693 6863
Tel. Typesafe: +41 21 691 4967

Sue Hinton
Joined: 2011-07-20,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
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
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
Did you do a clean build?

On Wed, Jul 20, 2011 at 11:46 AM, Sue Hinton <suehintone [at] gmail [dot] com> wrote:
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.

Sue Hinton
Joined: 2011-07-20,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
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 2
Joined: 2010-04-28,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt
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;)Zjava.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)(full trace at https://gist.github.com/1350811)
If I rebuild with scala-2.10.0.r25972-b20111109023956 I don't see the problem.
James Moore 2
Joined: 2010-04-28,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt

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 2
Joined: 2010-04-28,
User offline. Last seen 42 years 45 weeks ago.
Re: java.lang.VerifyError on RichInt

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland