Skip to content

Commit 85410dc

Browse files
author
xiaojun
committed
Fix: Add @nullable annotations to fix Checker Framework nullness errors
1 parent ccf22e3 commit 85410dc

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

linq4j/src/main/java/org/apache/calcite/linq4j/tree/UnsignedType.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private static ULong toULongNonNull(Number n, RoundingMode mode) {
306306
}
307307
return Unsigned.ulong(s);
308308
}
309-
public static UShort toUShort(Object o) {
309+
public static @Nullable UShort toUShort(Object o) {
310310
if (o == null) {
311311
return null;
312312
}
@@ -316,7 +316,7 @@ public static UShort toUShort(Object o) {
316316
throw new IllegalArgumentException("Cannot cast to UShort: " + o.getClass());
317317
}
318318

319-
public static UByte toUByte(Object o) {
319+
public static @Nullable UByte toUByte(Object o) {
320320
if (o == null) {
321321
return null;
322322
}
@@ -326,20 +326,14 @@ public static UByte toUByte(Object o) {
326326
throw new IllegalArgumentException("Cannot cast to UByte: " + o.getClass());
327327
}
328328

329-
public static UInteger toUInteger(Object o) {
330-
if (o == null) {
331-
return null;
332-
}
329+
public static @Nullable UInteger toUInteger(Object o) {
333330
if (o instanceof Number) {
334331
return UInteger.valueOf(((Number) o).longValue());
335332
}
336333
throw new IllegalArgumentException("Cannot cast to UInteger: " + o.getClass());
337334
}
338335

339-
public static ULong toULong(Object o) {
340-
if (o == null) {
341-
return null;
342-
}
336+
public static @Nullable ULong toULong(Object o) {
343337
if (o instanceof Number) {
344338
return ULong.valueOf(((Number) o).longValue());
345339
}

0 commit comments

Comments
 (0)