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

can't use Date.iso8601 with a string subclass #5252

Closed
ahorek opened this issue Jul 16, 2018 · 5 comments
Closed

can't use Date.iso8601 with a string subclass #5252

ahorek opened this issue Jul 16, 2018 · 5 comments
Assignees
Milestone

Comments

@ahorek
Copy link
Contributor

@ahorek ahorek commented Jul 16, 2018

Environment

jruby 9.2.1.0-SNAPSHOT (2.5.0) 2018-07-15 8833646 Java HotSpot(TM) 64-Bit Server VM 10.0.1+10 on 10.0.1+10 +jit [mswin32-x86_64]

Expected Behavior

require 'date'
class StringSubclass < String; end
Date.iso8601(StringSubclass.new("-4712-01-01"))

#<Date: -4712-01-01 ((0j,0s,0n),+0s,2299161j)>

Actual Behavior

never ends

spec ruby/spec#612

@ahorek
Copy link
Contributor Author

@ahorek ahorek commented Jul 16, 2018

@kares
Copy link
Member

@kares kares commented Jul 16, 2018

nice find, thanks @ahorek ... somehow naively assumed the internal ClassIndex is retained for sub-class

@kares kares self-assigned this Jul 16, 2018
@kares
Copy link
Member

@kares kares commented Jul 16, 2018

this likely means #5250 is a no-op (no changes required if this is fixed), right?

@ahorek
Copy link
Contributor Author

@ahorek ahorek commented Jul 16, 2018

btw: only string class inheritance is relevant, we don't have to check other cases. I don't know if there's a better way how to do this without an if/else statement. Please advice.

#5250 is still relevant, the original problem was a wrong exception class, later I've found this.

@kares
Copy link
Member

@kares kares commented Jul 16, 2018

okay, if its only String than we're simply do one more if check as you tried - will try to tweak your commit

@kares kares added this to the JRuby 9.2.1.0 milestone Jul 16, 2018
@kares kares closed this in 5470f05 Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants