Skip to content

Frozen String error message different from MRI #1907

@alexfalkowski

Description

@alexfalkowski

Hi Team,

There seems to be a bit of inconsistency with the error messages when we try to modify frozen object.

In Ruby MRI:

s = String.new.freeze
s.upcase!

RuntimeError: can't modify frozen String

In JRuby:

s = String.new.freeze
s.upcase!

RuntimeError: can't modify frozen string

The difference here is the casing.

If we have a custom class

class Test
  attr_accessor :name
end

In Ruby MRI:

t = Test.new.freeze
t.name = 'Test'

RuntimeError: can't modify frozen Test

In JRuby:

t = Test.new.freeze
t.name = 'Test'

RuntimeError: can't modify frozen

In this example we are missing the name of the class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions