Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support method access for nested Java classes #2639

Closed
kares opened this issue Mar 2, 2015 · 7 comments
Closed

support method access for nested Java classes #2639

kares opened this issue Mar 2, 2015 · 7 comments

Comments

@kares
Copy link
Member

kares commented Mar 2, 2015

assuming Java integration already works in a Java-like manner :
java.lang.management.MemoryType.value_of('HEAP')

shall support Java-like java.awt.Desktop.Action.valueOf('OPEN')
instead of "only" Ruby-like java.awt.Desktop::Action.valueOf('OPEN')

@headius
Copy link
Member

headius commented Mar 12, 2015

So you're basically saying to allow nested classes to be accessible with "." as well as "::", yes?

@kares
Copy link
Member Author

kares commented Mar 13, 2015

yy, since JRuby allows java.awt.Desktop where by Ruby semantics it "should" be java.awt::Desktop
... and we also handle nested upper-case package names right basePackage.UglyPackageName.Klass

I'm just not sure if there aren't any draw-backs for introducing fully Java "like" nested class access ?

@kares kares added the beginner label Apr 6, 2016
@rohitdumbre86
Copy link

Hello Guys!! I want to work on this particular issue. Any pointers as in can I maven build the jruby java code?

@kares
Copy link
Member Author

kares commented Nov 30, 2016

@rohitdumbre86 hey! believe some of those can be figured out - it's quite a std mvn build.
... check .travis-ci.yml or there's also https://github.com/jruby/jruby/blob/master/BUILDING.md

if you need to better understand JRuby's Java Integration - look for commits tagged with [ji] prefix

@MariuszCwikla
Copy link
Contributor

I prepared solution, although I am not 100% it's the best one.
I'm handling inner class case from within method_missing. Please review.

@edipofederle
Copy link
Contributor

@headius / @kares I think this one could be closed as well. Could you please check it? thx

@headius
Copy link
Member

headius commented Jun 15, 2021

@edipofederle It seems like we eventually decided that using method_missing to solve this was too heavy-handed, at least based on #5924, so this behavior has never been added. I am still of the opinion that inner classes are best accessed using Foo::Bar syntax, but it should be possible to make Foo.Bar work without method_missing (the list of inner classes is static and known at load time).

So... we can close this if @kares no longer wants to support Foo.Bar, but should leave it open otherwise.

@kares kares closed this as completed Jun 16, 2021
@enebo enebo added this to the Invalid or Duplicate milestone Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants