Fix 3303 refactor zoneHelper into getRubyTimeZoneName #3331
this broke truffle using the
In order to reuse and mimic Time#zone behavior the timezone name logic in RubyTime.zoneHelper needs to be refactored into 2 separated methods: one that receives the environment TZ as a String and another that will extract the enviroment TZ from the runtime. The isTzRelative is only used by RubyTime itself and there is no need to expose it, thus it was moved back into RubyTime.zone. Truffle's org.jruby.truffle.noded.TimePrimitiveNodes has been updated to make use of the new getRubyTimeZoneName method.
According to the spec "%Z" and Time#zone should behave the same. This fix makes use of RubyTime.getRubyTimeZoneName to closely mimic RubyTime.zone behavior. Note that it is still possible to fail the above spec when the RubyTime object is created with a numeric TZ relative to UTC (thus setting isTzRelative to true) because there is no way to reproduce this particular behavior from within RubyDateFormatter.
@kares Thanks for catching this, I should have build it before committing the code as Eclipse was unable to properly detect truffle as a java project and explicitly show the compilation failure. Sorry about that.
I updated my code and build it locally to avoid failures this time.
I also made a small update in Truffle to make use of the new method.