Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: JRuby 1.6.2
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Java Integration
-
Labels:None
-
Environment:Android 3.1, ruboto-core master
-
Number of attachments :
Description
Hi!
I need to access
android.R.id.home or android.R::id.home
This is a standard constant in Android. "id" is an inner class of android.R.
I am able to access the class using
JavaUtilities.get_proxy_class('android.R$id').home
so I have an acceptable workaround, but JRUBY-4666 states I should be able to access the class without using JavaUtilities.
Any way to do this?
The main problem here is that the class starts with a lower-case name; we don't currently map inner classes that are not capitalized.
The easiest way to do this may be to import the class as a specific name, rather than trying to access it directly:
~/projects/jruby ➔ cat Blah.java public class Blah { public static class id { public static String hello() { return "hello"; } } } ~/projects/jruby ➔ jruby -rjava -e 'import "Blah$id" do; "Blah_id"; end; p Blah_id.hello' "hello"I suppose we could improve the inner class mapping to support lower-case class names, but in general all such cases we've left to explicit imports, even for normal top-level classes.