question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Add nullable reference annotations.

See original GitHub issue

The playwright library has no clear documentation about whether an argument or return type can be null. In the original TypeScript library it’s not a problem since the type system of TypeScript supports nullable annotation. For example, the page.contentText has a string | null type, which indicates that it may be null. With strictNullCheck compiler option, you can’t call its methods without proper null check.

image

However, in this project, the nullable annotation is absent, neither the documentation points out the fact that it can be null.

image

Java actually has a plenty of null annotations. These annotations can also be identify in Kotlin. I hope nullable can be properly annotated like the TypeScript library, or at least be documented.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
3flexcommented, Apr 24, 2022

Couple of points:

  1. From @yury-s: “we’d need to pick one of the third-party options which may work for some people but potentially cause conflicts for others” - is this really a blocker? There are countless projects adding nullability annotations of one flavour or another to their libraries, as far as I know the only major issue is that there’s no standardisation (JSpecify will hopefully one day address this, but until then…)
  2. At least some nullability annotation would majorly assist all IDE users, and Kotlin users when compiling
  3. If adding annotation to source is truly not an option, could we instead get external annotations? They can be published in a separate artifact.
1reaction
seekMcommented, Jan 15, 2022

Since Java 8 it’s possible to indicate that no value might be present using the Optional class. Could that maybe be used an alternative to annotations (for return types, at least)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The annotation for nullable reference types should only be ...
The nullable annotation context of any given source line is either enabled or disabled. You can think of the pre-C# 8.0 compiler as...
Read more >
Nullable reference types - Microsoft Learn
You use annotations that can declare whether a variable is a nullable reference type or a non-nullable reference type. These annotations make ...
Read more >
Annotating your C# code - Migrating to nullable reference types
Migrating to using nullable reference types becomes easier when your dependencies have nullable annotations in place, whether the native C# ...
Read more >
Nullable Reference Types: Contexts and Attributes – A Look at ...
Nullable annotation context – When this context is enabled, all the nullability information that includes attributes and NRTs in public ...
Read more >
Nullable Reference Types - C# Corner
The nullable annotation and warning context can be set for a project using the Nullable element in your csproj file. These settings define...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found