check that argument to keys/vals is a Map

Description

Current behavior:

  • If you call keys or vals on something that is not a Map, you do not get a ClassCastException until the KeySeq or ValSeq is consumed

  • Calling keys or vals on an empty collection of any type, even non-Map types, returns nil

The attached patch:

  • checks the type of the argument to keys and vals and throws IllegalArgumentException if it is neither java.util.Map nor null

  • changes tests for keys and vals to check that those functions throw IllegalArgumentException on empty collections that are not maps

Environment

None

Status

Assignee

Unassigned

Reporter

Stuart Sierra

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Backlog

Priority

Minor
Configure