-
-
Notifications
You must be signed in to change notification settings - Fork 942
Labels
Milestone
Description
This is a bit of a stretch, usually not something that happens in production but still Ruby class removing is not that uncommon.
class SubList < java.util.ArrayList
def initialize(arg1, arg2)
puts "initialize #{self}"
super(arg1 + arg2)
end
end
class SubSubList < SubList
end
p SubSubList.new(1, 2)
Object.send(:remove_const, :SubSubList)
# ... while parent SubList stays around (if it's removed as well it's not an issue)
class SubSubList < SubList
end
p SubSubList.new(1, 2)Environment Information
Provide at least:
- JRuby 9.3.0.0 - 9.4.6.0
Expected Behavior
- Script works, reification is able to deal with the removed sub-class while parent was kept
Actual Behavior
- Second
SubSubList.newwill fail:
initialize
#<SubSubList: []>
ArgumentError: wrong number of arguments for constructor
<main> at repro_java_sub_class.rb:26
due (-XreifylogErrors):
2024-03-05T15:10:02.637+01:00 [main] ERROR RubyClass : failed to reify class SubSubList due to:
java.lang.LinkageError: loader org.jruby.util.OneShotClassLoader @1f172892 attempted duplicate class definition for rubyobj.SubSubList. (rubyobj.SubSubList is in unnamed module of loader org.jruby.util.OneShotClassLoader @1f172892, parent loader org.jruby.java.codegen.MultiClassLoader @6ba6557e)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at org.jruby.dist/org.jruby.util.OneShotClassLoader.defineClass(OneShotClassLoader.java:20)
at org.jruby.dist/org.jruby.RubyClass.reify(RubyClass.java:1447)
Reactions are currently unavailable