Skip to content

Repository functions can return null elements in collections #2852

@Carlrs

Description

@Carlrs

It's possible to get null elements in a collection of non-nullable elements (using Kotlin). No idea why Kotlin isn't complaining about it either until I try to access an element, but here are the steps for reproducing:

  1. Have database view with ID that is a composite of multiple columns, one of which is null (rendering the entire ID for that row as null)
  2. Have repository interface for said view, with the entity's ID as a nullable value of type String
  3. Repository interface should have some function that returns List (non-nullable!)
  4. Call repository function, try to iterate over the results doing something that requires the elements to be not null
  5. Get java.lang.NullPointerException

Expectation: Either the collection won't include the DB view rows where ID is null, or it'll have the entity ID as null, but either way, there should be no null objects in the returned collection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions