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

Extended class clones and duplicates become unmarshable #4340

Closed
gdeoliveira opened this Issue Nov 27, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@gdeoliveira
Copy link

gdeoliveira commented Nov 27, 2016

Environment

Running inside 9-alpine docker container.

jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-internal-alpine-r0-b14 +jit [linux-x86_64]
Linux dfcfcfee1b70 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 Linux

This issue may be related to #4339.

Expected Behavior (MRI 2.3.1)

Extension = Module.new
Klass = Class.new { extend Extension }
Clone = Klass.clone
Dup = Klass.dup

Marshal.dump(Clone)
#=> "\x04\bc\nClone"

Marshal.dump(Dup)
#=> "\x04\bc\bDup"

Actual Behavior

Extension = Module.new
Klass = Class.new { extend Extension }
Clone = Klass.clone
Dup = Klass.dup

Marshal.dump(Clone)
TypeError: can't dump anonymous class #<Class:0x5656be13>
	from org/jruby/RubyMarshal.java:102:in `dump'
	from (irb):5:in `<eval>'
	from org/jruby/RubyKernel.java:998:in `eval'
	from org/jruby/RubyKernel.java:1299:in `loop'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from /opt/jruby/bin/irb:13:in `<main>'

Marshal.dump(Dup)
TypeError: can't dump anonymous class #<Class:0x14cd1699>
	from org/jruby/RubyMarshal.java:102:in `dump'
	from (irb):6:in `<eval>'
	from org/jruby/RubyKernel.java:998:in `eval'
	from org/jruby/RubyKernel.java:1299:in `loop'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from org/jruby/RubyKernel.java:1118:in `catch'
	from /opt/jruby/bin/irb:13:in `<main>'
@headius

This comment has been minimized.

Copy link
Member

headius commented Nov 29, 2016

Looks like a problem with the class-name-setting behavior of constants. Confirmed it fails on JRuby master, and it does not fail if the extend call is omitted.

@gdeoliveira

This comment has been minimized.

Copy link

gdeoliveira commented Nov 29, 2016

The same problem seems to be present in the 1.7 version of JRuby according to the failing tests I'm getting here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment