Skip to content

super with kwargs splat causes HashMap to convert to Hash #6452

@headius

Description

@headius

The kwargs handling for the following code appears to be too aggressive, and results in the HashMap getting converted into a normal Ruby Hash:

h = java.util.HashMap.new
class X
  def blah(*args, **kwargs)
    args
  end
end
class Y < X
  def blah(*args)
    super
  end
end
arr = Y.new.blah(h)
p arr[0].class # Hash, should be java.util.HashMap

This is the cause of recent CI failures in spec:ji, due to the recent rspec-expectations 3.9.3 release. The specific change was rspec/rspec-expectations@23c1de7 as part of rspec/rspec-expectations#1187 which appears to have been made to better support keyword arguments in the method_missing based matchers (like be_equal?, which is what started failing in our JI specs).

I will pin our Gemfile to rspec-expectations 3.9.2 to get the build green again, but this needs to be addressed for 9.3 at least and possibly 9.2.14 as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions