Skip to content

Translate nullability/optional typescript properties and methods into @Nullable / @NotNull annotations in the Java CDK #6026

@ivoanjo

Description

@ivoanjo

Please add the @Nullable / @NotNull annotations as appropriate when generating the Java CDK bindings from typescript constructs that are marked as optional or as not optional.

Use Case

While Java has no native way of saying "this can be null" / "this is not expected to be null", the @Nullable / @NotNull annotations are a way of doing that, enabling

  • Developers working on IDEs such as IntelliJ to get helpful messages when they don't check for null
  • Tools such as FindBugs to find problematic usages in a codebase

and even better in my case

Proposed Solution

Add the annotations when generating Java code.

Other

There's also a feature request asking for this in the AWS Java SDK, which unfortunately has not been addressed yet.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

Labels

effort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.jsiiThis issue originates in jsii, or this feature must be implemented in jsii.language/javaRelated to Java bindings

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions