JRuby

Test for Java class extension depends on Sun JDK specifics

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.4
  • Fix Version/s: JRuby 1.1.5
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Number of attachments :
    0

Description

The following test in test_higher_javasupport depends on a detail of Sun's ArrayList implementation: that it will call ensureCapacity when adding:

  class FooArrayList < ArrayList
    $ensureCapacity = false
    def foo
      size
    end
    def ensureCapacity(howmuch)
      $ensureCapacity = true
      super
    end
  end

  def test_extending_java_classes
    l = FooArrayList.new
    assert_equal(0, l.foo)
    l.add(100)
    assert_equal(1, l.foo)
    assert_equal(true, $ensureCapacity)
  end

I have disabled it in the script because it fails to pass on IBM's JDK. We need a better test for this behavior (protected method overriding perhaps?) that doesn't depend on Sun JDK specific details.

Activity

Hide
Charles Oliver Nutter added a comment -

Resolved by creating a new test (spec) in spec/java_integration/types/extension_spec.rb that does not depend on Sun JDK internals. Committed in 7917.

Show
Charles Oliver Nutter added a comment - Resolved by creating a new test (spec) in spec/java_integration/types/extension_spec.rb that does not depend on Sun JDK internals. Committed in 7917.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: