Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scabug opened this issue Apr 9, 2012 · 3 comments
Closed

Comments

@scabug
Copy link

scabug commented Apr 9, 2012

[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.

@scabug
Copy link
Author

scabug commented Apr 9, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5652?orig=1
Reporter: @retronym
Affected Versions: 2.9.1, 2.10.0
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented May 8, 2012

@adriaanm said:
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

@scabug
Copy link
Author

scabug commented May 25, 2012

@retronym said (edited on May 26, 2012 7:29:06 AM UTC):
Here's an attempt to fix this.

scala/scala#627

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants