Scala Programming Language
  1. Scala Programming Language
  2. SI-5652

VerifyError due to public lambda-lifted method overriding a final method

    Details

      Description

      [Thanks to Paul for the minimization below]

      On Mon, Apr 9, 2012 at 9:48 AM, Jason Zaugg <jzaugg@gmail.com> wrote:
      > A quick attempt to minimize can't reproduce this (which would make it
      easier to retest with a newer compiler version.)

      Thinking about how it could happen made it possible to reproduce it.

      It's particularly evil because it only happens with separate
      compilation. Here's the single file version. This has no
      VerifyError.

         // one file
         class A1 {
           def f1 = { def g = 5 ; class A { def a = g } ; new A }
         }
         class A2 extends A1 {
           def f2 = { def g = 5 ; class A { def a = g } ; new A }
         }
         object Test extends A2 {
           def main(args: Array[String]) { }
         }
      

      But do it like this...

         // a.scala
         class A1 {
           def f1 = { def g = 5 ; class A { def a = g } ; new A }
         }
         // b.scala
         class A2 extends A1 {
           def f2 = { def g = 5 ; class A { def a = g } ; new A }
         }
         object Test extends A2 {
           def main(args: Array[String]) { }
         }
      

      And off we go.

         % scalac a.scala
         % scalac b.scala
         % scala Test
         java.lang.VerifyError: class A2 overrides final method g$1.()I
             at java.lang.ClassLoader.defineClass1(Native Method)
             at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
             at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
             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)
      

      Still in trunk naturally.

        Activity

        Hide
        Adriaan Moors added a comment -

        should name mangle the lambda lifted method to include the outer class's name
        normally, don't need to include the class name since they should end up being private

        they're public here because they're accessed from an inner class

        Show
        Adriaan Moors added a comment - should name mangle the lambda lifted method to include the outer class's name normally, don't need to include the class name since they should end up being private they're public here because they're accessed from an inner class
        Hide
        Jason Zaugg added a comment - - edited

        Here's an attempt to fix this.

        https://github.com/scala/scala/pull/627

        Show
        Jason Zaugg added a comment - - edited Here's an attempt to fix this. https://github.com/scala/scala/pull/627

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Jason Zaugg
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development