Skip to content

Commit 8ad8a5e

Browse files
committed
fix nullability and other warnings
1 parent 6f1d836 commit 8ad8a5e

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

objectbox-java/src/main/java/io/objectbox/Box.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
*/
4646
@Beta
4747
@ThreadSafe
48+
@SuppressWarnings("WeakerAccess,UnusedReturnValue,unused")
4849
public class Box<T> {
4950
private final BoxStore store;
5051
private final Class<T> entityClass;
@@ -427,7 +428,7 @@ public void remove(long id) {
427428
/**
428429
* Removes (deletes) Objects by their ID in a single transaction.
429430
*/
430-
public void remove(long... ids) {
431+
public void remove(@Nullable long... ids) {
431432
if (ids == null || ids.length == 0) {
432433
return;
433434
}

objectbox-java/src/main/java/io/objectbox/Cursor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import io.objectbox.annotation.apihint.Temporary;
2828
import io.objectbox.relation.ToMany;
2929

30-
@SuppressWarnings({"unchecked", "SameParameterValue", "unused"})
30+
@SuppressWarnings({"unchecked", "SameParameterValue", "unused", "WeakerAccess", "UnusedReturnValue"})
3131
@Beta
3232
@Internal
3333
@NotThreadSafe

objectbox-java/src/main/java/io/objectbox/KeyValueCursor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import javax.annotation.concurrent.NotThreadSafe;
2222

2323
@NotThreadSafe
24+
@SuppressWarnings("WeakerAccess,UnusedReturnValue, unused")
2425
public class KeyValueCursor implements Closeable {
2526
private static final int PUT_FLAG_FIRST = 1;
2627
private static final int PUT_FLAG_COMPLETE = 1 << 1;

objectbox-java/src/main/java/io/objectbox/Property.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serializable;
2020
import java.util.Collection;
2121

22+
import javax.annotation.Nullable;
23+
2224
import io.objectbox.annotation.apihint.Internal;
2325
import io.objectbox.converter.PropertyConverter;
2426
import io.objectbox.exception.DbException;
@@ -29,6 +31,7 @@
2931
/**
3032
* Meta data describing a property
3133
*/
34+
@SuppressWarnings("WeakerAccess,UnusedReturnValue, unused")
3235
public class Property<ENTITY> implements Serializable {
3336
private static final long serialVersionUID = 8613291105982758093L;
3437

@@ -56,12 +59,13 @@ public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, S
5659
}
5760

5861
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
59-
String dbName) {
62+
@Nullable String dbName) {
6063
this(entity, ordinal, id, type, name, isId, dbName, null, null);
6164
}
6265

6366
public Property(EntityInfo<ENTITY> entity, int ordinal, int id, Class<?> type, String name, boolean isId,
64-
String dbName, Class<? extends PropertyConverter> converterClass, Class customType) {
67+
@Nullable String dbName, @Nullable Class<? extends PropertyConverter> converterClass,
68+
@Nullable Class customType) {
6569
this.entity = entity;
6670
this.ordinal = ordinal;
6771
this.id = id;

objectbox-java/src/main/java/io/objectbox/Transaction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
@Internal
2828
@NotThreadSafe
29+
@SuppressWarnings("WeakerAccess,UnusedReturnValue,unused")
2930
public class Transaction implements Closeable {
3031
/** May be set by tests */
3132
@Internal

objectbox-java/src/main/java/io/objectbox/query/QueryCondition.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class AbstractCondition implements QueryCondition {
4949
this.values = null;
5050
}
5151

52-
AbstractCondition(Object[] values) {
52+
AbstractCondition(@Nullable Object[] values) {
5353
this.value = null;
5454
this.values = values;
5555
}
@@ -75,13 +75,13 @@ public enum Operation {
7575
public final Property property;
7676
private final Operation operation;
7777

78-
public PropertyCondition(Property property, Operation operation, Object value) {
78+
public PropertyCondition(Property property, Operation operation, @Nullable Object value) {
7979
super(checkValueForType(property, value));
8080
this.property = property;
8181
this.operation = operation;
8282
}
8383

84-
public PropertyCondition(Property property, Operation operation, Object[] values) {
84+
public PropertyCondition(Property property, Operation operation, @Nullable Object[] values) {
8585
super(checkValuesForType(property, operation, values));
8686
this.property = property;
8787
this.operation = operation;

0 commit comments

Comments
 (0)