Implementing Interfaces:

Showing 1-3 of 3 messages
Implementing Interfaces: Peter Ehrlich 10/14/12 11:40 PM
Hey -- new here to Java and to Mirah.  I'm experimenting with using it in combination with the LeJos project to control lego robotics.

Trying to implement this java code is giving me trouble.  Here's the spec from their tutorial:

Button.ENTER.addButtonListener(new ButtonListener() {
      public void buttonPressed(Button b) {
        LCD.drawString("ENTER pressed", 0, 0);

      public void buttonReleased(Button b) {

And here's my (failing) Mirah implementation.  Hopefully, there some dumb mistake that I just wouldn't think of:

class MyButtonListener
  implements ButtonListener

  def buttonPressed(b: Button):void
    LCD.drawString("ESC pressed", 0, 6)

  def buttonReleased(b: Button):void
    LCD.drawString("ESC released", 0, 6)

// and later:
listener =

It gives me the following error:

$ mirahc --java --classpath /Users/peter/Downloads/leJOS_NXJ_0.9.1beta-3/lib/nxt/classes.jar  test.mirah 
Inferring types...
test.mirah:32: can't convert Mirah::JVM::Types::TypeDefinition into String
Mirah::InternalCompilerError: can't convert Mirah::JVM::Types::TypeDefinition into String
         infer at /Users/peter/.rvm/gems/jruby-
         infer at /Users/peter/.rvm/gems/jruby-
       resolve at /Users/peter/.rvm/gems/jruby-
          each at org/jruby/

See the full docs:

Cheers & Thanks for any help!
Re: Implementing Interfaces: Nick Howard 10/15/12 11:20 AM
Looks like you might have found a bug. Could you try compiling with --verbose and dumping the output in a gist/pastebin? It'd be helpful to have the full test.mirah file too.
-Nick Howard

Re: Implementing Interfaces: Peter Ehrlich 10/15/12 7:00 PM
You guys sure know how to do verbose! Here's the output and the source:

Thanks for the help