Skip to content

Multiple assignment deconstruction fails with Java Lists #459

@adamonduty

Description

@adamonduty

I've come across an issue with multiple assignment that is similar to JRUBY-6404.

I show current and expected behavior in this gist, but the idea is that Java ArrayList's (and presumably any Java List) don't deconstruct with multiple assignment the same as a ruby array:

  a = [1,2]
  b, c = a
  # => b = 1, c =2

With a Java ArrayList, b = a and c = nil.

In the gist, I used a small workaround by aliasing to_ary => to_a, but I'm guessing this isn't very efficient.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions