#primitive array nullability
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
it tells me to move the @Nullable
so its like this:
private int[] @Nullable [] test = null;
this doesnt seem right
same warning
I assume it applies to the leftmost type
Okay I think I understand it
which is int
It's because you cannot annote a primitive as it's not an object
oh really
yes
So it's trying to apply the annotation to int[] because...?
it's tryng to apply the annotation to int
which is obv not allowed
Wait no, I'm not fully wrong
meaning that you want to prevent storing nulls inside the array
It doesn't extend object
for Integer[] that would be fine
but this doesn't prevent the array itself from pointing at null
regardless of whether it's primitive or not
I think you dont really understand what I want
I want to set the array itself null not the elements inside
which would be fine for arrays even with primitives
use kotlin 
💀
Integer[] should work though?
var array: IntArray?
my problem is the annotation
no
once again
as this:
private @Nullable int[][] itemFrameEntityIds = null;
thinks I want to apply the annotation to the int
you're marking the individual elements as nullable
but this:
private int[] @Nullable [] itemFrameEntityIds = null;
is way to ugly
I'm pretty sure it's not
Can you find a source?
evidently it is, as indicated by the error that he's getting
"cannot annotate primitives"
@unborn osprey can you try with Integer[]
I really think that would get rid of the err
that would remove the warning, but still annotate the elements inside the array instead the array itself
it will, but would it give the desired outcome?
I'm gonna read docs brb
I might just make a new class anyways, that would remove the warning aswell