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

Class names are mutable #5480

Closed
sudoremo opened this issue Nov 29, 2018 · 1 comment
Closed

Class names are mutable #5480

sudoremo opened this issue Nov 29, 2018 · 1 comment
Labels
Milestone

Comments

@sudoremo
Copy link

Environment

  • jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.172-b11 on 1.8.0_172-b11 +jit [darwin-x86_64]
  • Darwin albus.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64

Expected Behavior (MRI 2.5)

irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> Foo.name
=> "Foo"
irb(main):003:0> Foo.name << 'bla'
=> "Foobla"
irb(main):004:0> Foo.name
=> "Foo"

Actual Behavior (jRuby 9.2.0.0)

jirb(main):001:0> class Foo; end
=> nil
jirb(main):002:0> Foo.name
=> "Foo"
jirb(main):003:0> Foo.name << 'bla'
=> "Foobla"
jirb(main):004:0> Foo.name
=> "Foobla"
@headius
Copy link
Member

headius commented Nov 29, 2018

Oops!

@headius headius added this to the JRuby 9.2.5.0 milestone Nov 29, 2018
headius added a commit to headius/jruby that referenced this issue Nov 29, 2018
This duplicates logic in `to_s` that dups the module name before
returning it, but also ensures that any cached module name is
frozen so it can't be modified in place.

Fixes jruby#5480.
headius added a commit to headius/jruby that referenced this issue Nov 29, 2018
This duplicates logic in `to_s` that dups the module name before
returning it, but also ensures that any cached module name is
frozen so it can't be modified in place.

Fixes jruby#5480.
headius added a commit to headius/jruby that referenced this issue Nov 29, 2018
@headius headius added the core label Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants