Questions tagged [non-nullable]
232 questions
1
vote
2 answers
Understand @Nonnull and @CheckForNull anotations
In my Spring project there is a service
public PageablefindAccount(String accountExternalId){
if (accountExternalId== null) {
throw new ProjectException("Missing account");
}
...
}
So when I java 5 arguments I have…

Xelian
- 16,680
- 25
- 99
- 152
1
vote
1 answer
Initialize not null jagged array
I am currently studying computing at UCLAN and I have to write a program using Spec# and I need a 2 dimensial jagged array which can not be null.
I know for a normal array I can declare it like this
T![]!
but when i want to declare it for a…

Vincenz Mössenböck
- 453
- 1
- 4
- 8
1
vote
2 answers
How to make computed column not nullable?
So far I've been using ISNULL(dbo.fn_GetPrice(ItemId), 0) to make it not nullable (rather call it default-valued, but whatever).
Is this the right way?

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
1
vote
4 answers
Writing Nullable value with BinaryWriter
I want to write a nullable string to file using BinaryWriter and this code:
BinaryWriter writer = new BinaryWriter(st);
String? s;
if(s!=null){
writer.Write(s);
}
but this error occurs:
The type 'string' must be a non-nullable…

Majid
- 13,853
- 15
- 77
- 113
1
vote
1 answer
abstract class and non-nullable value type
I'm trying to compile the code (More iterator fun with the producer/consumer pattern
) proposed by the guru 'Joe Duffy', for class producer / consumer, but this error is occurring:
(I'm using visual studio 2010 and net 4.0.3)
Program.cs(37,34):…

lsalamon
- 7,998
- 6
- 50
- 63
0
votes
1 answer
Filtering for Non-Nullable Strings in C# Lists
I'm trying to create a list of non-nullable string values by filtering, but I always end up with a list of nullable strings.
var list = new List {"Cars", "Audi", "", "1920"};
var list2 = list.Where(p =>…

group
- 9
- 2
0
votes
1 answer
How to use Lombok's RequiredArgsConstructor with Nullaway?
We're trying to add "Nullaway" (https://github.com/uber/NullAway) to our repo. This is a tool that assumes everything not annotated with @Nullable can't be null and enforces it in compile time.
We also use Lombok, with focus on @Data. Lombok decides…
0
votes
0 answers
Data annotation Required in Entity Framework Core with MySQL seems to work incorrectly
In my project, I have a table:
[Table("users")]
public class User
{
[Column("id"), Key, Required]
public int Id { get; set; }
[Column("name"), MaxLength(64)]
public string Name { get; set; }
}
The property Name is not flagged with…
0
votes
1 answer
Why does `toString()` method on a null object in Dart not throw an exception?
I have the following code snippet in Dart:
void main(List args){
String? test1 = null;
String test2 = test1.toString();
print(test1);
print(test2);
}
I expected the second print() statement to output an empty string because test2 is…

Siavash TS
- 41
- 4
0
votes
0 answers
typeorm: how do I correctly save a lazy related entity with {nullable: false}?
Stack:
Typeorm: 0.3.15
Node
Express: ^4.18.2
Typescript
MySQL
I have a User entity in my application that has a reference property to its parent Organization. I've mapped the organization property as a Promise to enforce lazy loading and its…

Mike
- 1
- 1
0
votes
0 answers
React-native Update form Data
React native I have update the form data using API. I can send the textinput values to store. But they only send null values. In postman the data store correctly react-native contains only error.How to fix this?
How to fix and store the data

Raj kumar
- 23
- 5
0
votes
1 answer
How can I create a non-nullable variable when it's initialized in an event?
This is razor code but I think the same can happen in most any C# code in an event driven architecture.
private List Users { get; set; }
protected override async Task OnInitializedAsync()
{
Users = await Context.Users.Include(u =>…

David Thielen
- 28,723
- 34
- 119
- 193
0
votes
1 answer
How to fix Non-nullable instance field 'sharedPreferences' must be initialized
when I upgrade flutter to 2.15, errors disppay as following:
import 'package:shared_preferences/shared_preferences.dart';
class SharedPreferencesUtil {
SharedPreferencesUtil._();
static SharedPreferencesUtil _instance;
SharedPreferences…
0
votes
0 answers
Cannot return null for non-nullable type: 'null' within parent 'Model*Connection' (graphql, amplify)
I am working on an Amplify app that uses ReactJS, GraphQL, and DynamoDB. When a user creates an Event the response includes both the created Event as well as a non-nullable error. The event DOES successfully get created but the response includes an…

jwarshaw
- 259
- 2
- 7
0
votes
3 answers
Nullable class is recognized as non-nullable, Kotlin, Android Studio
Maybe it's a silly question, but I've been thinking about it the whole morning. I try to get data from another activity via Register activity result using a nullable class, but Kotlin sees it as a nonnullable class and doesn't allow me to…

W1ggex
- 3
- 2