Questions tagged [non-nullable]

232 questions
0
votes
1 answer

disable @Nonnull annotation on "implement methods"

IntelliJ is adding @Nonnull annotations on code generated via the implement methods feature. How to prevent IntelliJ from annotating signatures with that annotation? IntelliJ 2019.1 Thanks
beluchin
  • 12,047
  • 4
  • 24
  • 35
0
votes
2 answers

Enterprise Architect - how to extract nullability of a database table column?

I have a database table defined in EA. In this table I have a column where NULL is allowed. When I use a script or an API to extract nullability from this column, I understand this should be done using the LowerBound and UpperBound values. When…
Ruudjah
  • 807
  • 7
  • 27
0
votes
1 answer

Android Nullbale and NonNull: Method invocation 'getSearchableInfo' may produce 'NullPointerException'

I have below code snippet but it shows warnings Method invocation 'getSearchableInfo' may produce 'NullPointerException' ComponentName s = getComponentName(); if (s ==null) return; @NonNull ComponentName componentName =…
VSB
  • 9,825
  • 16
  • 72
  • 145
0
votes
1 answer

Multiple @EnsuresNonNullIf should be ok; but the compiler complains

The manual of the Checker Framework claims "You can write multiple @EnsuresNonNullIf annotations on a single method", however I observe the following message if I try this: @EnsuresNonNullIf(expression="getFieldNames()",…
Jurgen Vinju
  • 6,393
  • 1
  • 15
  • 26
0
votes
1 answer

Lombok generating constructor without @Nonnull annotation

I'm using Lombok for generating my POJOs. I've got a bunch of fields annotated with javax.annotation.Nonnull and I expect this annotation to be transferred to the constructor automatically. However, this is not happening, Lombok seems to omit this…
0
votes
3 answers

If I'm using non-nullable reference types, how do I show that I didn't find anything?

I've enabled the C# 8.0 non-nullable reference types feature in one of my projects, but now I'm unclear about how to represent missing data. For example, I'm reading a file whose lines are colon-separated key/value pairs. Sometimes there's more…
Ryan Lundy
  • 204,559
  • 37
  • 180
  • 211
0
votes
1 answer

Typescript type RequireSome removing undefined AND null from properties

RequireSome type from another, very simialar question. This question is similar but it should not be a duplicate since here we want to also remove null as well as undefined from properties. Maybe the name shouldn't be Require but something like…
ZenVentzi
  • 3,945
  • 3
  • 33
  • 48
0
votes
2 answers

int cast as object in properties is 0 when null

Sorry I couldn't think of a better title to describe the issue. I use the following code to make it easier to update specific values of config properties. Note that the config properties are not just integers and there are not just 2 of them, just…
Sakuya
  • 660
  • 5
  • 23
0
votes
1 answer

Get error "Cannot convert to null 'Point' because it is a non-nullable value type."

Sorry advance for such a simple question ( I have googled but I am stumped, new to programming) sample code below public Point GetRandomWalkableLocationInRoom(Rectangle room) { if (DoesRoomHaveWalkableSpace(room)) { …
Muzzasa
  • 5
  • 1
  • 4
0
votes
0 answers

Kotlin nullable comparison: different expression vs function result

I don't get the following results: I have a function alreadyDoneToday():Boolean. While debugging I noticed an odd behavior. The expression itself returns true, but false when wrapped inside the function. var lastDone: Date? = null ... fun today():…
Matthias
  • 1,267
  • 1
  • 15
  • 27
0
votes
3 answers

How can I run a query on a dataset that returns different columns to the table?

I'm trying to pull some data from a SQL table in my dataset using C#. In this case I do not need all the columns just a few specific ones, however as I am not pulling back a column with a mandatory NOT NULL, the copy of the table is throwing the…
G-.
  • 1,061
  • 3
  • 11
  • 29
0
votes
3 answers

Set null to Thread to prevent memory leak in onDestroy Android

I am using Thread for some Async operations. Now primarily I have 3 Threads like : private lateinit var horse1Thread: Thread private lateinit var horse2Thread: Thread private lateinit var timerThread: Thread Calling stop() in onDestroy() of…
0
votes
1 answer

How in kotlin to initialize a two dimensional non-nullable string array

Having a two demential string array and the row has only two items, i.e. {{"1", "a"} {"2", "b"}, {"3", "c"} ... ...} the invert function to do the invert public static String[][] invert(final String[][] array) { final String[][] newarray = new…
lannyf
  • 9,865
  • 12
  • 70
  • 152
0
votes
1 answer

Laravel migration cancel column as nullable

I created a migration with name column making nullable. How can I change name as not nullable? My previous migration code is given below: Schema::table('users', function($table) { $table->string('name', 50)->nullable(); });
0
votes
0 answers

null parameter in url

I have some javascript that calls an action method on a controller (MVC, C#) there are two parameters defined, both have values but I get a null reference exception. Heres the javascript that calls the action…
proteus
  • 545
  • 2
  • 12
  • 36