Skip to content

Improve QueryCursor.Options nullability #158

@Marcono1234

Description

@Marcono1234

Problem

  • For both public constructors of QueryCursor.Options the parameters are non-null
  • QueryCursor findCaptures and findMatches with allocator parameter have a non-null QueryCursor.Options

So if you want to use those findCaptures or findMatches methods with allocator parameter, you are forced to specify custom options, even if you don't want to customize them.

Side note: The Options constructor which takes both a progressCallback and a predicateCallback is currently private even though these options are not mutually exclusive I think. Maybe it would make sense to make that constructor public.

Potential solutions

  • Mark the parameters of the public QueryCursor.Options constructors as nullable, since they support null.
    (This is also the current workaround; simply provide null even though that violates the nullness annotations.)
  • Support null as options value for the findCaptures and findMatches methods.
  • Provide an Options.DEFAULT constant or similar which has the value new Options(null, null).

Please let me know if (and for which one) I should create a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions