Incendo / Incendo/cloud

Allow for optionals in annotated methods

Open
#768 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
548
Forks
60
PR merge metrics
No merged PRs in 30d

Description

We should allow for optionals to be used in annotated arguments in place of nullable parameters. Example:

@Command("command [component]")
public void someCommand(Optional<SomeType> component) {
  // ...
}

We should be able to infer the type of the optional without any issues. We will need to consider the mapping between components and optionals both when parsing & constructing the command tree, but also when mapping the parsed values to the method parameters.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the code that parses annotated arguments and constructs the command tree, then follow the mapping from parsed values to method parameters. Done means an annotated Optional argument can infer SomeType and correctly map both present and absent command components.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.