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 for const_get() in java_package_module_template #435

Closed
bwalsh opened this Issue Dec 9, 2012 · 0 comments

Comments

Projects
None yet
2 participants
@bwalsh
Copy link

bwalsh commented Dec 9, 2012

jruby/src/jruby/java/java_package_module_template.rb does not include an implementation of const_get().

use case:

Leveraging extends and include`s, I've added ActiveModel support to java pojos. This works well and I can now use pojos as full fledged models in rails apps. This is quite useful for integration.
see
http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/

However, some gems (ActiveSupport) pass the class into ActiveSupport::Dependencies.constantize(resource_class_name). This in turn calls active_support/inflector/methods.constantize() for each module which finally calls constant.const_get().

I've added a few trace statements and have seen the following

resource_class_name=::Java::ComMyCoPocModel::CardApplicant
constantize Object Java
constantize Java ComMyCoPocModel
constantize Java::ComMyCoPocModel CardApplicant
ArgumentError: Java package com.myco.poc.model' does not have a methodconst_get'

Looking at the code JavaPackageModuleTemplate, would an implementation of const_get() be similar to const_missing() ie call to JavaUtilities.get_proxy_class

@BanzaiMan BanzaiMan closed this in d3157b7 Jan 5, 2013

BanzaiMan added a commit that referenced this issue Jan 5, 2013

Merge pull request #465 from atambo/const_get
Add const_get to java package Fixes #435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.