diff options
author | Nassim Jahnke <[email protected]> | 2024-10-02 14:32:20 +0200 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-10-02 14:32:20 +0200 |
commit | 70b02c9d2e7657bcd305acf1da89380a28e982d7 (patch) | |
tree | a4a72147aa85b44df50b2fd56f6ada2b57a31e28 /CONTRIBUTING.md | |
parent | ec8b5b419fb08003e0600f7788d28c4d46c90ced (diff) | |
download | Paper-70b02c9d2e7657bcd305acf1da89380a28e982d7.tar.gz Paper-70b02c9d2e7657bcd305acf1da89380a28e982d7.zip |
[ci skip] Add section on nullability annotations (#11461)
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c50c0382e..2b1d36ac75 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -249,6 +249,17 @@ instead of adding a new import to the top of the file. If you are using a type a can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future patch conflicts in the import section of the file. +### Nullability annotations + +We are in the process of switching nullability annotation libraries, so you might need to use one or the other: + +**For classes we add**: Fields, method parameters and return types that are nullable should be marked via the +`@Nullable` annotation from `org.jspecify.annotations`. Whenever you create a new class, add `@NullMarked`, meaning types +are assumed to be non-null by default. For less obvious placing such as on generics or arrays, see the [JSpecify docs](https://jspecify.dev/docs/user-guide/). + +**For classes added by upstream**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These +will be replaced later. + ```java import org.bukkit.event.Event; // don't add import here, use FQN like below |