Skip to content

Commit

Permalink
refactor: Move @Nullable method annotations to the return type
Browse files Browse the repository at this point in the history
jkschneider and TeamModerne committed Jul 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent ec67d0e commit d143ce3
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -43,8 +43,7 @@ class RemoteProgressMessage {
this.id = id;
}

@Nullable
public String getMessage() {
public @Nullable String getMessage() {
return fragments.isEmpty() ? null : String.join("", fragments.values());
}

@@ -56,9 +55,8 @@ enum Type {
Exception
}

@Nullable
public static RemoteProgressMessage receive(DatagramSocket socket, Map<UUID, RemoteProgressMessage> incompleteMessages)
throws IOException {
public static @Nullable RemoteProgressMessage receive(DatagramSocket socket, Map<UUID, RemoteProgressMessage> incompleteMessages)
throws IOException {
byte[] buf = new byte[PACKET_LENGTH];
DatagramPacket packet = new DatagramPacket(buf, PACKET_LENGTH);
try {
@@ -76,8 +74,7 @@ public static RemoteProgressMessage receive(DatagramSocket socket, Map<UUID, Rem
* @param incompleteMessages A collection of incomplete messages.
* @return A {@link RemoteProgressMessage} if the message is completed by this packet, null otherwise.
*/
@Nullable
public static RemoteProgressMessage read(byte[] packet, int length, Map<UUID, RemoteProgressMessage> incompleteMessages) {
public static @Nullable RemoteProgressMessage read(byte[] packet, int length, Map<UUID, RemoteProgressMessage> incompleteMessages) {
if (length < 42) {
return null; // not a V2 packet;
}

0 comments on commit d143ce3

Please sign in to comment.