37
38 node.node("index").set(obj.getIndex());
39 node.node("item").set(itemStack);
40 node.node("action").set(obj.getItemAction());41 }
42}
35 final SerializableUmbrellaItem obj, final ConfigurationNode node) throws SerializationException {
36 final ItemStack itemStack = obj.getItemStack();
37
38 node.node("index").set(obj.getIndex());39 node.node("item").set(itemStack);
40 node.node("action").set(obj.getItemAction());
41 }
33 @Override
34 public void serialize(final Type type, @Nullable
35 final SerializableUmbrellaItem obj, final ConfigurationNode node) throws SerializationException {
36 final ItemStack itemStack = obj.getItemStack();37
38 node.node("index").set(obj.getIndex());
39 node.node("item").set(itemStack);
29 public void serialize(final Type type, @Nullable
30 final ItemStack obj, final ConfigurationNode node) throws SerializationException {
31 node.node("material").set(obj.getType());
32 node.node("durability").set(obj.getDurability());33 node.node("meta").set(obj.getItemMeta());
34 }
35}
30 final ItemStack obj, final ConfigurationNode node) throws SerializationException {
31 node.node("material").set(obj.getType());
32 node.node("durability").set(obj.getDurability());
33 node.node("meta").set(obj.getItemMeta());34 }
35}
This parameter is always used as if it is non-null, but the parameter may be null when the usage occurs.
public void doWork(MyClass myClass) {
// ...
// Dereference without a null check.
myClass.myField = "value";
// ...
}
// ...
MyClass nullable;
// ...
if (condition) nullable = new MyClass();
else nullable = null;
// ...
doWork(nullable); // If nullable is null, we will get an NPE
If you require that the parameter should never be null, consider changing the annotation to @NonNull
or an equivalent annotation to indicate that the method expects the value to be non-null.
If the variable is likely to be null, consider performing a null check before using the variable.