Skip to content

Calling overridden vararg method from Java causes AbstractMethodError #1459

@scabug

Description

@scabug

To see this error in action, just unzip the attachment and run compile.bat followed with run.bat.

I have a base class (Java) with one method:

public abstract class AbstractBase {
  abstract void doStuff(Object... params);
}

I create an implementation for it in scala:

class Concrete extends AbstractBase {
  override def doStuff(params:java.lang.Object*) = println("doStuff invoked")
}

Finally, I have a Caller class (Java) which just calls the abovementioned method, as follows:

public class Caller {
   public void callDoStuff(AbstractBase impl) {
	impl.doStuff(new Object());
   }
}

Now, a direct call succeeds:

  val impl = new Concrete
  impl.doStuff(null)

whereas the following fails

  val impl = new Concrete
  val caller = new Caller
  caller.callDoStuff(impl)

javac -version gives "1.6.0"
scalac -version gives "Scala compiler version 2.7.2.RC4"

I am running on Windows XP SP2 with scala 2.7.2.RC4.

java.lang.AbstractMethodError: base.AbstractBase.doStuff([Ljava/lang/Object;)V
        at base.Caller.callDoStuff(Caller.java:5)
        at foo.App$$.<init>(App.scala:17)
        at foo.App$$.<clinit>(App.scala)
        at foo.App.main(App.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions