Closed
Description
This issue will track Ruby 2.6 support for JRuby. This will be released in JRuby 9.3.0.0
As with previous releases, we will base our checklist on MRI's NEWS file: https://github.com/ruby/ruby/blob/ruby_2_6/NEWS
This bug will track all NEWS items new in Ruby 2.6. This list is based off https://github.com/ruby/ruby/blob/ruby_2_6/NEWS.
Only changes relevant to JRuby are listed here. MRI-specific internal changes and features are not included.
NOTE: Pull requests should be done against the ruby-2.6
branch. That branch will be merged via #6037.
Language changes
- Refinements take place at block passing Feature #14223
- Refinements take place at Kernel#public_send Feature #15326
- Refinements take place at Kernel#respond_to? Feature #15327
-
else
withoutrescue
causes a syntax error [Experimental] Feature #14606 - Constant names may start with a non-ASCII capital letter Feature #13770
- Endless ranges are introduced. Range that has no end, like
(0..)
or(0...)
Feature #12912 - Non-Symbol keys in a keyword arguments hash cause an exception.
- The “shadowing outer local variable” warning is removed. Feature #12490
- Print
cause
of the exception if the exception is not caught and printed its backtraces and error message. Feature #8257 - The flip-flop syntax is deprecated. Feature #5400
Core classes updates (outstanding ones only)
Array
- Add Array#union and Array#difference instance methods. Feature #14097
- Array#to_h now accepts a block that maps elements to new key/value pairs. Feature #15143
- Array#filter is a new alias for Array#select. Feature #13784
- Array#filter! is a new alias for Array#select!. Feature #13784
Binding
- Added Binding#source_location. Feature #14230
Dir
- Added Dir#each_child and Dir#children instance methods. Feature #13969
Enumerable
- Enumerable#chain returns an enumerator object that iterates over the elements of the receiver and then those of each argument in sequence. Feature #15144
- Enumerable#to_h now accepts a block that maps elements to new key/value pairs. Feature #15143
- Enumerable#filter is a new alias for Enumerable#select. Feature #13784
Enumerator::ArithmeticSequence
- This is a new class to represent a generator of an arithmetic sequence, that is a number sequence defined by a common difference. It can be used for representing what is similar to Python's slice. You can get an instance of this class from Numeric#step and Range#step.
Enumerator::Chain
- This is a new class to represent a chain of enumerables that works as a single enumerator, generated by such methods as Enumerable#chain and Enumerator#+.
Enumerator::Lazy
- Enumerator::Lazy#filter is a new alias for Enumerator::Lazy#select. Feature #13784
Enumerator
- Enumerator#+ returns an enumerator object that iterates over the elements of the receiver and then those of the other operand. Feature #15144
ENV
- ENV.to_h now accepts a block that maps names and values to new keys and values. Feature #15143
Exception
- Exception#full_message takes
:highlight
and:order options
. Bug #14324
Hash
- Hash#merge, Hash#merge!, and Hash#update now accept multiple arguments. Feature #15111
- Hash#to_h now accepts a block that maps keys and values to new keys and values. Feature #15143
- Hash#filter is a new alias for Hash#select. Feature #13784
- Hash#filter! is a new alias for Hash#select!. Feature #13784
IO
- Added new mode character
'x'
to open files for exclusive access. Feature #11258
Kernel
- Kernel#then is a new alias for Kernel#yield_self. Feature #14594
- Kernel#Complex, Kernel#Float, Kernel#Integer, and Kernel#Rational take an
:exception
option to specify the way of error handling. Feature #12732 - Kernel#system takes an
:exception
option to raise an exception on failure. Feature #14386 - Kernel#system and Kernel#exec do not close non-standard file descriptors (the default of the
:close_others
option is changed tofalse
, but we still set theFD_CLOEXEC
flag on descriptors we create). Misc #14907
KeyError
- KeyError.new accepts
:receiver
and:key
options to set receiver and key in Ruby code. Feature #14313
Method
- Added Method#<< and Method#>> for Proc composition. Feature #6284
Module
- Module#method_defined?, Module#private_method_defined?, and Module#protected_method_defined? now accept the second parameter as optional. Feature #14944
NameError
- NameError.new accepts a
:receiver
option to set receiver in Ruby code. Feature #14313
NilClass
- NilClass#=~ is added for compatibility. Feature #15231
NoMethodError
- NoMethodError.new accepts a
:receiver
option to set receiver in Ruby code. Feature #14313
Numeric
- Numeric#step now returns an instance of the Enumerator::ArithmeticSequence class rather than one of the Enumerator class.
OpenStruct
- OpenStruct#to_h now accepts a block that maps keys and values to new keys and values. Feature #15143
Proc
- Added Proc#<< and Proc#>> for Proc composition. Feature #6284
- Proc#call doesn't change
$SAFE
any more. Feature #14250
Random
- Added Random.bytes. Feature #4938
Range
- Added Range#% instance method. Feature #14697
- Range#=== now uses the
#cover?
instead of the#include?
method. Feature #14575 - Range#cover? now accepts a Range object. Feature #14473
- Range#step now returns an instance of the Enumerator::ArithmeticSequence class rather than one of the Enumerator class.
Regexp/String
- Update Unicode version from 10.0.0 to 11.0.0. Feature #14802
- Updated to 12.0.0 as of ruby/ruby@cff7eef
- Update Emoji version from 5.0 to 11.0.0 Feature #14802
String
- String#crypt is now deprecated. Feature #14915
- String#split yields each substring to the block if given. Feature #4780
Struct
- Struct#to_h now accepts a block that maps keys and values to new keys and values. Feature #15143
- Struct#filter is a new alias for Struct#select. Feature #13784
Time
- Time.new and Time#getlocal accept a timezone object as well as a UTC offset string. Time#+, Time#-, and Time#succ also preserve the timezone. Feature #14850
TracePoint
- “script_compiled” event is supported. Feature #15287
- TracePoint#parameters Feature #14694
- TracePoint#instruction_sequence Feature #15287
- TracePoint#eval_script Feature #15287
- TracePoint#enable accepts new keywords “target:” and “target_line:”.Feature #15289
Stdlib updates (outstanding ones only)
BigDecimal
- BigDecimal() accepts the new keyword “exception:” similar to Float().
Note for the differences among recent versions
The differences among recent versions of bigdecimal. Please select the suitable version of bigdecimal according to the following information.
- 1.3.5 has BigDecimal.new without “exception:” keyword. You can see the deprecation warning of BigDecimal.new when you specify “-w” option. BigDecimal(), BigDecimal.new, and Object#to_d methods are the same.
- 1.4.0 has BigDecimal.new with “exception:” keyword. You always see the deprecation warning of BigDecimal.new. Object#to_d method is different from BigDecimal() and BigDecimal.new.
- 2.0.0 will be released soon after releasing Ruby 2.6.0. This version will not have the BigDecimal.new method.
Bundler
- Add Bundler to Standard Library. Feature #12733
- Use 1.17.2, the latest stable version.
Coverage
- A oneshot_lines mode is added. Feature #15022
- Add
:oneshot_lines
keyword argument to Coverage.start. - Add
:stop
and:clear
keyword arguments to Coverage.result. Ifclear
is true, it clears the counters to zero. Ifstop
is true, it disables coverage measurement. - Coverage.line_stub, which is a simple helper function that creates the “stub” of line coverage from a given source code.
CSV
- Upgrade to 3.0.2. This includes performance improvements especially for writing. Writing is about 2 times faster. See github.com/ruby/csv/blob/master/NEWS.md.
ERB
- Add
:trim_mode
and:eoutvar
keyword arguments to ERB.new. Now non-keyword arguments other than the first one are softly deprecated and will be removed when Ruby 2.5 becomes EOL. Feature #14256 - erb command's
-S
option is deprecated, and will be removed in the next version.
FileUtils
- FileUtils#cp_lr. Feature #4189
Matrix
- Matrix#antisymmetric?, Matrix#skew_symmetric?
- Matrix#map!, Matrix#collect! Feature #14151
- Matrix#[]=
- Vector#map!, Vector#collect!
- Vector#[]=
Net
- Add
:write_timeout
keyword argument to Net::HTTP.new. Feature #13396 - Add Net::HTTP#write_timeout and Net::HTTP#write_timeout=. Feature #13396
- Add Net::HTTPClientException to deprecate Net::HTTPServerException, whose name is misleading. Bug #14688
NKF
- Upgrade to nkf v2.1.5
Psych
- Upgrade to Psych 3.1.0
RDoc
- Become about 2 times faster.
- Use SOURCE_DATE_EPOCH to generate files.
- Fix method line number that slipped off.
- Enable
--width
,--exclude
, and--line-numbers
that were ignored. - Add support for blockquote by “>>>” in default markup notation.
- Add support for “Raises” lines in TomDoc notation.
- Fix syntax error output.
- Fix many parsing bugs.
REXML
- Upgrade to REXML 3.1.9. See (github.com/ruby/rexml/blob/master/NEWS.md).
-
concat()
function: Stringify all arguments before concatenating. -
string()
function: Support context node. -
string()
function: Support processing instruction node. - Support
"*:#{ELEMENT_NAME}"
syntax in XPath 2.0. -
"//#{ELEMENT_NAME}[#{POSITION}]"
case -
string()
function: Fixfunction(document)
returns nodes that are out of root elements. -
"/ #{ELEMENT_NAME} "
case -
"/ #{ELEMENT_NAME} [ #{PREDICATE} ]"
case -
"/ #{AXIS}::#{ELEMENT_NAME}"
case -
"#{N}-#{M}"
case: One or more white spaces were required before"-"
-
"/child::node()"
case -
"#{FUNCTION}()/#{PATH}"
case -
"@#{ATTRIBUTE}/parent::"
case -
"name(#{NODE_SET})"
case
CSV
- Upgrade to 3.0.4. See (github.com/ruby/csv/blob/master/NEWS.md).
RSS
- RSS::Parser.parse now accepts options as Hash.
:validate
,:ignore_unknown_element
,:parser_class
options are available.
RubyGems
- Upgrade to RubyGems 3.0.1
- (blog.rubygems.org/2018/12/19/3.0.0-released.html)
- (blog.rubygems.org/2018/12/23/3.0.1-released.html)
Set
- Set#filter! is a new alias for Set#select!. Feature #13784
URI
- Add URI::File to handle the file URI scheme. Feature #14035
Compatibility issues (excluding feature bug fixes)
Dir
- Dir.glob with
'\0'
-separated pattern list will be deprecated, and is now warned. Feature #14643
File
- File.read, File.binread, File.write, File.binwrite, File.foreach, and File.readlines do not invoke external commands even if the path starts with the pipe character '|'. Feature #14245
Object
- Object#=~ is deprecated. Feature #15231
Stdlib compatibility issues (excluding feature bug fixes)
These standard libraries have been promoted to default gems.
- e2mmap
- forwardable
- irb
- logger
- matrix
- mutex_m
- ostruct
- prime
- rexml
- rss
- shell
- sync
- thwait
- tracer
BigDecimal
- The following methods are removed.
- BigDecimal.allocate
- BigDecimal.ver
- Every BigDecimal object is frozen. Feature #13984
- BigDecimal() parses the given string similar to Float().
- String#to_d parses the receiver string similar to String#to_f.
- BigDecimal.new will be removed in version 2.0.
Pathname
- Pathname#read, Pathname#binread, Pathname#write, Pathname#binwrite, Pathname#each_line and Pathname#readlines do not invoke external commands even if the path starts with the pipe character
'|'
. This follows Feature #14245