Skip to content

Commit

Permalink
[test] case for the bug report at jrubyGH-8141
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Mar 7, 2024
1 parent 1b7fdff commit e3aacb5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/java_integration/reify/become_java_spec.rb
Expand Up @@ -116,6 +116,39 @@ class TopRightOfTheJStack < MiddleOfTheJStack ;def size; super + 3; end ; end
expect(TopLeftOfTheJStack.new.size).to eq 0
expect(TopRightOfTheJStack.new([:a, :b]).size).to eq (2+3)
end

it "supports auto reifying a class hierarchy when class gets redefined" do
class ASubList < java.util.ArrayList
attr_reader :args
def initialize(arg1, arg2)
@args = [arg1, arg2]
super(arg1 + arg2)
end
end
class ASubSubList < ASubList; end
expect( ASubSubList.new(1, 2).args ).to eql [1, 2]

Object.send(:remove_const, :ASubSubList)

class ASubSubList < ASubList; end
expect( ASubSubList.new(1, 2).args ).to eql [1, 2]

Object.send(:remove_const, :ASubSubList)
Object.send(:remove_const, :ASubList)

class ASubList < java.util.ArrayList
attr_reader :args
def initialize(arg1, arg2)
@args = [arg2, arg1]
super(arg1 + arg2)
end
end
class ASubSubList < ASubList; end
expect( ASubSubList.new(1, 2).args ).to eql [2, 1]

Object.send(:remove_const, :ASubSubList)
Object.send(:remove_const, :ASubList)
end

it "constructs in the right order using the right methods" do
class BottomOfTheCJStack < java.util.ArrayList
Expand Down

0 comments on commit e3aacb5

Please sign in to comment.