2,504 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
177
views
"Type argument is not within its bounds: must be subtype of 'Any'" in Kotlin application after upgrade to Spring Boot 4.0.0
After upgrading my Kotlin application from Spring Boot 3.5.8 to Spring Boot 4.0.0,
I get a lot of compiler errors
Type argument is not within its bounds: must be subtype of 'Any'.
How is it possible ...
Advice
0
votes
1
replies
61
views
In which scenario the UsersRequestBuilder.get() from Microsoft Graph SDK will return null?
I am using the com.microsoft.graph.serviceclient.GraphServiceClient class to retrieve users:
UserCollectionResponse userCollectionResponse = graphClient.users().get(conf -> {
conf....
2
votes
2
answers
136
views
C# Pass null to Generic Method Receiving Nullable Type [duplicate]
The following code generates CS1503 with the message:
error CS1503: Argument 1: cannot convert from '<null>' to 'T?'
public class MyClass<T> where T : notnull
{
// This is the only ...
5
votes
1
answer
161
views
Accessing JSpecify Nullable annotation via reflection
I'm trying to run the following code with Java 25
package test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.lang.reflect.Field;
import org.jspecify.annotations.Nullable;
...
1
vote
1
answer
282
views
'Member may be null' even though it is set in base constructor
Suppose in C# I have one class that inherits from another like this:
internal class TestImplementation : TestBase
{
[SetsRequiredMembers]
public TestImplementation(List<string> param) : ...
0
votes
0
answers
38
views
Annotation to tell null-checking a property is not null?
Consider this code (C# 12/.NET 8):
class Content
{
public string Value { get; set; }
}
class Something
{
public bool IsOK { get; set; }
public Content? TheContent { get; set; }
}
...
-3
votes
1
answer
119
views
How can I pass a reference to an internal class upon construction of a public-facing subclass without violating nullabe safety?
I'm not super experienced with C#, and this is a bit of a puzzle. Consider the following code:
#nullable enable
using System.Collections.Generic;
// Biology.dll
public abstract class Animal
{
...
2
votes
1
answer
173
views
AnyNull extension method - is there a way to assert nullability?
So I've got a little method that looks like:
public static bool AnyNull(params object?[] args)
{
if (args.Any(a => IsNull(a)))
{
return true;
}
return false;
}
private ...
2
votes
3
answers
279
views
Why does List.copyOf(...) use a redundant array creation?
The method java.util.List#copyOf in Java 24 calls another method java.util.ImmutableCollections#listCopy which has the following body:
@SuppressWarnings("unchecked")
static <E> ...
1
vote
1
answer
131
views
NotNullIfNotNull, but using the return value instead of a parameter
I have a function that returns a nullable result and has an out parameter that is also nullable:
public Result? GetResult(out Parameter? parameter)
{
Result? result = //...get the result somehow
...
1
vote
2
answers
111
views
Nullable property in generic interface [duplicate]
I've read several of the other questions on the topic of nullable types in generics and I still don't understand why MinMaxBase<T> and MyIntDecl compile and YourIntDecl doesn't.
The compiler ...
1
vote
2
answers
136
views
Is there a way to tell the compiler in C# that nullable collection inside object was already checked for null earlier in the call stack?
I have this one specific case, where I have a model for an entity in our project, and that model has a collection inside it.
That collection is nullable, like so:
public class Model {
public List<...
0
votes
1
answer
107
views
Reference to value in nested nullable structs
I am guessing the answer will eventually be "no, you can't do that", but trying to figure out how to do a thing in C#.
I am wondering on a bit of glue code between two pieces that I do not ...
0
votes
2
answers
111
views
How to distinguish a generic default parameter value from a user-provided one? [duplicate]
I am working on a program that can use different cryptographical ciphers, though I don't think the actual application is incorrect. The
entire codebase is here (a bit of an older version without the ...
0
votes
1
answer
90
views
Nullable T parameter
I have an object with the following inheritance:
[ProtoContract]
public class Country : CountryCommon<Country, ConstructDB.Country>
{
Which inherits:
public abstract class CountryCommon<T, ...