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

Working with Ruby 3.1+ #8

Open
Chrispie opened this issue Jun 18, 2024 · 2 comments
Open

Working with Ruby 3.1+ #8

Chrispie opened this issue Jun 18, 2024 · 2 comments

Comments

@Chrispie
Copy link

Chrispie commented Jun 18, 2024

Hi
I am trying to implement this in my gradle project but running into an issue. It seems like it is relating to the Ruby version 3.1 onwards.

I have setup a sample project here with just 2 asciidoc files and a gradle build.

In my build.gradle file if I set the JRuby version to

  • 9.3.14.0 it works -> From my understanding 9.3.x will work with Ruby 2.6.x
  • 9.4.7.0 it fails -> From my understanding 9.4.x will work with Ruby 3.1.x

The error that I am getting is in the processor.rb class on line 67:

Caused by: org.jruby.exceptions.ArgumentError: (ArgumentError) wrong number of arguments (given 1, expected 0)
	at RUBY.initialize(uri:classloader:/gems/asciidoctor-interdoc-reftext-0.5.3/lib/asciidoctor/interdoc_reftext/processor.rb:66)
	at org.jruby.RubyClass.new(org/jruby/RubyClass.java:922)
	at RUBY.add_document_processor(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:1387)
	at RUBY.tree_processor(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:844)
	at RUBY.<main>(uri:classloader:/gems/asciidoctor-interdoc-reftext-0.5.3/lib/asciidoctor/interdoc_reftext.rb:10)
	at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:2620)
	at RUBY.activate(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:744)
	at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1981)
	at RUBY.activate(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:739)
	at RUBY.initialize(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:498)
	at org.jruby.RubyClass.new(org/jruby/RubyClass.java:935)
	at RUBY.load(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/load.rb:84)

My knowledge of Ruby is just too little to know why. I have seen though that on a stackoverflow site that in the later versions of Ruby the () is needed on a super call. Do you know if there are any other way to get around this to enforce a later version of ruby?

@jirutka
Copy link
Owner

jirutka commented Jun 18, 2024

Hi,

9.3.14.0 it works -> From my understanding 9.3.x will work with Ruby 2.6.x
9.4.7.0 it fails -> From my understanding 9.4.x will work with Ruby 3.1.x

That’s not correct; 9.3.x is compatible with Ruby 2.6.x, 9.4.x is compatible with Ruby 3.1.x.

asciidoctor-interdoc-reftext 0.5.2 is compatible with Ruby 2.1–2.7. Version 0.5.3 is compatible with 2.7 and 3.x (Ruby 2.6 is unsupported by upstream for many many years). It’s tested on CI even against the latest JRuby and all tests passed last month.

uri:classloader:/gems/asciidoctor-interdoc-reftext-0.5.4

This is suspicious… the latest released version is 0.5.3, there’s no 0.5.4 (yet).

I have seen though that on a stackoverflow site that in the later versions of Ruby the () is needed on a super call.

I’m quite sure it’s not; parens in function calls are optional in Ruby.

@Chrispie
Copy link
Author

Chrispie commented Jun 19, 2024

Apologies for the 0.54. I tried playing around with the source code (I corrected my log output in the original question to avoid confusion).

I upgraded from 0.5.2 to 0.5.3. I get the exact same behavior when using JRuby 9.4.7.0:

Caused by: org.jruby.exceptions.ArgumentError: (ArgumentError) wrong number of arguments (given 1, expected 0)
	at RUBY.initialize(uri:classloader:/gems/asciidoctor-interdoc-reftext-0.5.3/lib/asciidoctor/interdoc_reftext/processor.rb:66)
	at org.jruby.RubyClass.new(org/jruby/RubyClass.java:922)
	at RUBY.add_document_processor(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:1387)
	at RUBY.tree_processor(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:844)
	at RUBY.<main>(uri:classloader:/gems/asciidoctor-interdoc-reftext-0.5.3/lib/asciidoctor/interdoc_reftext.rb:10)
	at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:2620)
	at RUBY.activate(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:744)
	at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1981)
	at RUBY.activate(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/extensions.rb:739)
	at RUBY.initialize(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/document.rb:498)
	at org.jruby.RubyClass.new(org/jruby/RubyClass.java:935)
	at RUBY.load(uri:classloader:/gems/asciidoctor-2.0.23/lib/asciidoctor/load.rb:84)`

I tried downgrading JRuby as well. It happens in 9.4.0.0. Looks like something does not work with JRuby going from 9.3.14 to 9.4.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants