Nested interfaces broken

34 views
Skip to first unread message

Brendan Ribera

unread,
Jan 20, 2011, 4:12:29 PM1/20/11
to mi...@googlegroups.com
I'm trying to implement a nested interface from the Android codebase. There are several, but GpsStatus.Listener (http://developer.android.com/reference/android/location/GpsStatus.Listener.html) will do for this example.

Here's an example class:

import android.util.Log
import android.location.GpsStatus
class Example
  implements GpsStatus.Listener
  def onGpsStatusChanged(event:int)
    Log.v("test", "event: " + event)
  end
end

This fails to compile:
compile:
    [javac] Compiling 2 source files to /home/brendan/code/git/trunk/droid/urbandroid/bin/classes
     [exec] Inference Error:
     [exec] ./com/urbanspoon/Example.mirah:7: undefined method `declared_intrinsics' for nil:NilClass
     [exec]   def onGpsStatusChanged(event:int)
     [exec] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     [exec]     Log.v("test", "event: " + event)
     [exec] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     [exec]   end
     [exec] ^^^^^
     [exec] Result: 1

I see the same behavior with a similar Listener interface declared inside a class in the Java portion of our codebase. Interfaces that aren't nested work just fine. Anyone know why, or have a workaround?

-Brendan

Brendan Ribera

unread,
Jan 20, 2011, 4:42:44 PM1/20/11
to mi...@googlegroups.com
I can make it work with 0.0.6.dev by doing this:

import android.location.GpsStatus.Listener
[...]
  implements Listener

This breaks in 0.0.5:
     [exec] Inference Error:
     [exec] ./com/urbanspoon/NearbyActivity.mirah:10: Class 'android.location.GpsStatus.Listener' not found.

It'd be nice if one didn't have to bring interfaces with generic names like 'Listener' into the current namespace in order to implement them (what if I want to implement multiple Listeners?), but I think I can move on with what I'm trying to do now :)

-Brendan
Reply all
Reply to author
Forward
0 new messages