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

Zlib::GzipWriter cannot be properly sub-classed #7476

Closed
postmodern opened this issue Nov 23, 2022 · 0 comments · Fixed by #7511
Closed

Zlib::GzipWriter cannot be properly sub-classed #7476

postmodern opened this issue Nov 23, 2022 · 0 comments · Fixed by #7511
Milestone

Comments

@postmodern
Copy link

It is not possible to sub-class Zlib::GzipWriter and override the initialize method so that it accepts additional keyword arguments.

Steps To Reproduce

require 'zlib'
require 'stringio'

class ZlibSubClass < Zlib::GzipWriter

  def initialize(io, kwarg: 'foo')
    super(io)
  end

end

io = StringIO.new('')
ZlibSubClass.new(io, kwarg: 'bar')

Environment Information

  • jruby 9.4.0.0 (3.1.0) 2022-11-23 95c0ec159f OpenJDK 64-Bit Server VM 17.0.5+8 on 17.0.5+8 +jit [x86_64-linux]
  • Linux dev 6.0.9-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 16 17:50:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Expected Behavior

Accepts additional keyword arguments.

Actual Behavior

ArgumentError: wrong number of arguments (given 2, expected 1)
  initialize at test_jruby_zlib_initialize.rb:6
         new at org/jruby/ext/zlib/JZlibRubyGzipWriter.java:75
         new at org/jruby/ext/zlib/JZlibRubyGzipWriter.java:66
      <main> at test_jruby_zlib_initialize.rb:13
... 5 levels...
@headius headius added this to the JRuby 9.4.1.0 milestone Nov 23, 2022
enebo added a commit to enebo/jruby that referenced this issue Dec 2, 2022
enebo added a commit that referenced this issue Dec 5, 2022
Fixes #7476. Zlib::GzipWriter cannot be properly sub-classed
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

Successfully merging a pull request may close this issue.

2 participants