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
remofritzsche opened this Issue Nov 29, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@remofritzsche
Copy link

remofritzsche commented Nov 29, 2018

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

This comment has been minimized.

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

Never return the internal module name as a mutable string.
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

Never return the internal module name as a mutable string.
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

@enebo enebo closed this in #5481 Nov 29, 2018

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.