From 98fee3f171ce6e9a5ff5cb79537539758a85e08a Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Tue, 14 Jan 2020 11:25:02 -0600 Subject: [PATCH 1/2] Change return type to RubyArray The existing signature conflicts with one added to JRuby 9.2.9. Specifically, the new signature in JRuby returns RubyArray, which causes a compilation error on this line in Nokogiri because it attempts to use a more general return type. We would prefer to keep the specific return type in JRuby. * If we patch JRuby, then 9.2.9 will never be able to compile any version of Nokogiri. * If we patch Nokogiri, all versions of JRuby can compile current and future Nokogiri. Versions prior to 9.2.9 will be able to compile all existing releases of Nokogiri. I do not believe the change in 9.2.9 breaks anything at runtime, since the JVM does not care about this particular return type mismatch unless someone actually returns a non-RubyArray object. Fixes #1968 --- ext/java/nokogiri/XmlNodeSet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/java/nokogiri/XmlNodeSet.java b/ext/java/nokogiri/XmlNodeSet.java index 831e3af183..d437cd376b 100644 --- a/ext/java/nokogiri/XmlNodeSet.java +++ b/ext/java/nokogiri/XmlNodeSet.java @@ -39,6 +39,7 @@ import java.util.Arrays; import org.jruby.Ruby; +import org.jruby.RubyArray; import org.jruby.RubyClass; import org.jruby.RubyFixnum; import org.jruby.RubyObject; @@ -391,7 +392,7 @@ public IRubyObject subseq(ThreadContext context, int start, int length) { } @JRubyMethod(name = {"to_a", "to_ary"}) - public IRubyObject to_a(ThreadContext context) { + public RubyArray to_a(ThreadContext context) { return context.runtime.newArrayNoCopy(nodes); } From 17f910c001db6566b44c556dac6f58912488a3b8 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sat, 11 Jan 2020 13:26:33 -0500 Subject: [PATCH 2/2] update to use rake-compiler ~1.1.0 --- Gemfile | 2 +- Rakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a036c766b4..5d1ee1eec2 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem "hoe-git", "~>1.6", :group => [:development, :test] gem "minitest", "~>5.8", :group => [:development, :test] gem "racc", "~>1.4.14", :group => [:development, :test] gem "rake", "~>12.0", :group => [:development, :test] -gem "rake-compiler", "~>1.0.3", :group => [:development, :test] +gem "rake-compiler", "~>1.1.0", :group => [:development, :test] gem "rake-compiler-dock", "~>0.7.0", :group => [:development, :test] gem "rexical", "~>1.0.5", :group => [:development, :test] gem "rubocop", "~>0.73", :group => [:development, :test] diff --git a/Rakefile b/Rakefile index 96f6473424..8fba9acb89 100644 --- a/Rakefile +++ b/Rakefile @@ -148,7 +148,7 @@ HOE = Hoe.spec 'nokogiri' do ["minitest", "~> 5.8"], ["racc", "~> 1.4.14"], ["rake", "~> 12.0"], - ["rake-compiler", "~> 1.0.3"], + ["rake-compiler", "~> 1.1.0"], ["rake-compiler-dock", "~> 0.7.0"], ["rexical", "~> 1.0.5"], ["rubocop", "~> 0.73"],