Skip to content

Class generated for interface-implementing block does not match signature when arg not specified #69

@nedgar

Description

@nedgar
interface Console do
  def write(s:String):void;end
end

class Greeter
  def greet(m:String, c:Console)
    c.write m
  end
end

Greeter.new.greet("Hi") {
  puts "Yo"
}

Generates the following class for the block:

  public static class __xform_tmp_2 extends java.lang.Object implements Console {
...
    public void write() {
...

At runtime, this results in:

Exception in thread "main" java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.AbstractMethodError: BlockTest1$__xform_tmp_2.write(Ljava/lang/String;)V
    at Greeter.greet(BlockTest1.mirah:8)
    at BlockTest1.main(BlockTest1.mirah:12)

I've also had it crash the VM on one of the SWT Snippets, if this happens when it's in a callback e.g. due to button press.

The signature should be write(String m) instead, even if m is not used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions