Skip to content

Commit cb4e7fc

Browse files
authored
Merge pull request #7510 from enebo/writer_subclass
Fixes #7479. Cannot sub-class Zlib::GzipWriter and call .wrap
2 parents cb9e58c + e66136c commit cb4e7fc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.jruby.Ruby;
3434
import org.jruby.RubyBoolean;
3535
import org.jruby.RubyClass;
36+
import org.jruby.RubyModule;
3637
import org.jruby.RubyObject;
3738
import org.jruby.RubyString;
3839
import org.jruby.RubyTime;
@@ -41,7 +42,6 @@
4142
import org.jruby.runtime.Block;
4243
import org.jruby.runtime.Helpers;
4344
import org.jruby.runtime.JavaSites;
44-
import org.jruby.runtime.ObjectAllocator;
4545
import org.jruby.runtime.ThreadContext;
4646
import org.jruby.runtime.builtin.IRubyObject;
4747
import org.jruby.util.ByteList;
@@ -87,8 +87,7 @@ public static IRubyObject wrap19(ThreadContext context, IRubyObject recv, IRubyO
8787
Ruby runtime = recv.getRuntime();
8888
RubyGzipFile instance;
8989

90-
// TODO: People extending GzipWriter/reader will break. Find better way here.
91-
if (recv == runtime.getModule("Zlib").getClass("GzipWriter")) {
90+
if (((RubyModule) recv).isKindOfModule(runtime.getModule("Zlib").getClass("GzipWriter"))) {
9291
instance = JZlibRubyGzipWriter.newInstance(recv, args);
9392
} else {
9493
instance = JZlibRubyGzipReader.newInstance(recv, args);

0 commit comments

Comments
 (0)