Skip to content

Commit

Permalink
Update nullability annotations for deserialization context
Browse files Browse the repository at this point in the history
Replaced @NullMarked with @nonnull in TagDeserializationContext and added @NullMarked to the NBT class. This change ensures stricter nullability contracts for deserialization methods and provides clearer nullability intent for the overall serialization framework.
  • Loading branch information
NonSwag committed Oct 31, 2024
1 parent 356bf89 commit 87cf95c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions nbt/src/main/java/core/nbt/serialization/NBT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import core.nbt.tag.Tag;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;
import org.jspecify.annotations.Nullable;

/**
* The NBT class provides methods to serialize and deserialize objects to and from NBT tags,
* as well as to register custom serializers and deserializers for different types.
*/
@NullMarked
public final class NBT {
private final Serializer serializer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package core.nbt.serialization;

import core.nbt.tag.Tag;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NonNull;

/**
* Interface defining the context for deserializing tags into their respective objects.
*/
@NullMarked
public interface TagDeserializationContext {
/**
* Deserializes a given tag to an object of the specified type.
Expand All @@ -17,6 +15,5 @@ public interface TagDeserializationContext {
* @param <T> the type of the object to be returned
* @return an object of the specified type deserialized from the tag
*/
@Nullable
<T> T deserialize(Tag tag, Class<T> type);
<T> T deserialize(@NonNull Tag tag, @NonNull Class<T> type);
}

0 comments on commit 87cf95c

Please sign in to comment.