groovy
  1. groovy
  2. GROOVY-4967

List to LinkedHashSet inconsistent conversion behavior vs List to HashSet

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.5, 2.0-beta-2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      a), b), and c) all work, but d) fails with "GroovyCastException: Cannot cast object '[x]' with class 'java.util.ArrayList' to class 'java.util.LinkedHashSet'"

      a)

      List x = []
      HashSet<String> lhs = x
      

      b)

      List x = ['x']
      HashSet<String> lhs = x
      

      c)

      List x = []
      LinkedHashSet<String> lhs = x
      

      d)

      List x = ['x']
      LinkedHashSet<String> lhs = x
      

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Roshan Dawrani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: