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

JRuby 9.0.5.0: Struct fails to keep the constant name when autoloaded #4453

Closed
amatsuda opened this issue Jan 24, 2017 · 3 comments
Closed
Milestone

Comments

@amatsuda
Copy link

I'm not sure whether 9.0.x is still maintained, but let me raise an incompatibility issue that seems to be introduced in 9.0.5.0 and already fixed in 9.1.x.

  • JRuby version (jruby -v): jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]

  • Operating system and platform (e.g. uname -a): Darwin myhostname.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Sep 1 15:01:16 PDT 2016; root:xnu-3248.60.11~2/RELEASE_X86_64 x86_64

When loading a Struct via autoload and assigning it to a constant in JRuby 9.0.5.0, the loaded Struct is not associated with the Constant.

For example, having the following t.rb, y.rb, and z.rb:

# t.rb
X = Struct.new(:x)
require_relative 'y'
autoload :Z, "#{__dir__}/z.rb"

p x: X, y: Y, z: Z
# y.rb
Y = Struct.new(:y)
# z.rb
Z = Struct.new(:z)

MRI 2.2+, JRuby 9.0.4.0, and JRuby 9.1.7.0 prints {:x=>X, :y=>Y, :z=>Z} but only JRuby 9.0.5.0 prints {:x=>X, :y=>Y, :z=>#<Class:0x2b2948e2>}.

amatsuda referenced this issue in rails/rails Jan 24, 2017
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
@kares
Copy link
Member

kares commented Jan 24, 2017

thanks @amatsuda ... 9.0 is not maintained separately -> 9.1 is a successor. this won't fix in a 9.0.x release

@kares kares added this to the Won't Fix milestone Jan 24, 2017
yahonda added a commit to yahonda/oracle-enhanced that referenced this issue Jan 24, 2017
@headius
Copy link
Member

headius commented Jan 24, 2017

@kares Thanks for updating this. @amatsuda That is correct...we only maintain one 9.x line at a time.

@headius headius closed this as completed Jan 24, 2017
@amatsuda
Copy link
Author

@kares @headius Understood. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants