[SPIGOT-6314] Player getGameMode() can return null but is defined as @NotNull Created: 12/Jan/21  Updated: 14/Jan/21

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Matt D. Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Version: git-Spigot-628435a-b5e5adc
Guidelines Read: Yes

 Description   

Calling getGameMode() from a Player object returned by PlayerLoginEvent is null.

I don't know if this information can be made available earlier for this event; otherwise the annotation should be updated.



 Comments   
Comment by Matt D. [ 14/Jan/21 ]

I think it makes more sense to provide the correct nullable annotation and clarify when it's guaranteed to be NotNull in the doc than the reverse.

The annotation should alert you to a possible null exception. Otherwise you could argue away all annotations because "it's in the docs" anyways.

Comment by Black Hole [ 12/Jan/21 ]

I think it's better to clarify the JavaDoc of the PlayerLoginEvent that you can't rely on some NotNull annotations there.

Generated at Wed Apr 02 10:57:35 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.