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

AbstractMethodError with dependent method types and generics #6443

Closed
scabug opened this issue Sep 28, 2012 · 4 comments
Closed

AbstractMethodError with dependent method types and generics #6443

scabug opened this issue Sep 28, 2012 · 4 comments

Comments

@scabug
Copy link

scabug commented Sep 28, 2012

object Test extends App {
  trait A {
    type D <: C
    def foo(d: D)(x: X[d.type]): Unit
    trait C { this: D =>
      def bar(x: X[D]): Unit = foo(this)(x)
    }
    class X[-F <: D]
  }
  class B extends A {
    def foo(d: D)(x: X[d.type]): Unit = ()
    class D() extends C
    new D().bar(new X[D])
  }
  new B
}

produces the following at runtime:

java.lang.AbstractMethodError: Test$B.foo(LTest$A$C;LTest$A$X;)V
        at Test$A$C$class.bar(forms.scala:6)
        at Test$B$D.bar(forms.scala:13)
        at Test$B.<init>(forms.scala:14)
        at Test$.<init>(forms.scala:16)
        at Test$.<clinit>(forms.scala)
        at Test.main(forms.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
        at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
        at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
        at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
        at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
        at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
        at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

This is probably a duplicate of, or at least related to, #6135.

@scabug
Copy link
Author

scabug commented Sep 28, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6443?orig=1
Reporter: @propensive
Affected Versions: 2.10.0-M7
See #6135

@scabug
Copy link
Author

scabug commented Dec 2, 2012

@retronym said:
Reduced a little:

trait A {
  type D >: Null <: C
  def foo(d: D)(d2: d.type): Unit
  trait C {
    def bar: Unit = foo(null)(null)
  }
}
object B extends A {
  class D extends C

  def foo(d: D)(d2: d.type): Unit = ()
}

object Test extends App {
  new B.D().bar
}
scala> :javap -private A
Compiled from "t6443.scala"
public interface A{
    public abstract void foo(A$C, A$C);
}


scala> :javap -private B$
Compiled from "t6443.scala"
public final class B$ extends java.lang.Object implements A{
    public static final B$ MODULE$;
    public static {};
    public void foo(B$D, B$D);
    private B$();
}

We're missing a bridge method in B$ with the signature public void foo(A$C, A$C).

@scabug
Copy link
Author

scabug commented Dec 3, 2012

@retronym said:
scala/scala#1696

@scabug
Copy link
Author

scabug commented Jan 8, 2013

@retronym said:
scala/scala#1857

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