Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1252

Repository method returning Vavr Set results in cast exception if source value is not a Set

    XMLWordPrintable

    Details

      Description

      While Spring Data allows Vavr's Seq to be used as a return type in a repository interface, it appears that using Vavr Set results in a cast exception. This can be demonstrated with the Vavr example of the spring-data-examples GitHub project. If the return type for PersonRepository.findByFirstnameContaining() is changed to Set<Person> (and the integration test changed accordingly) then running the test throws the following error:

      java.lang.ClassCastException: io.vavr.collection.List$Cons cannot be cast to io.vavr.collection.Set
      at example.PersonRepositoryIntegrationTests.readsPeopleIntoJavaslangSeq(PersonRepositoryIntegrationTests.java:70)

      Changing the version of spring-boot-starter-parent in spring-data-example's POM from 2.0.0.M7 to 2.0.0.RC1 makes no difference.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            hamishlawson Hamish Lawson
            Last updater:
            Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: