Skip to content

Commit 87b5804

Browse files
committed
Switch to jspecify for nullability annotations
1 parent c216139 commit 87b5804

75 files changed

Lines changed: 156 additions & 249 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ allprojects {
7575
compileOnly(fabricApi.module("fabric-gametest-api-v1", fabricApiVersion))
7676
localImplementation("org.ladysnake:elmendorf:${props["elmendorf_version"]}")
7777

78-
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
7978
compileOnly("org.jetbrains:annotations:24.0.1")
8079
}
8180

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import net.minecraft.world.level.storage.ValueOutput;
3030
import org.jetbrains.annotations.ApiStatus;
3131
import org.jetbrains.annotations.Contract;
32-
import org.jetbrains.annotations.Nullable;
3332
import org.jetbrains.annotations.Unmodifiable;
33+
import org.jspecify.annotations.Nullable;
3434
import org.ladysnake.cca.api.v3.component.load.ClientLoadAwareComponent;
3535
import org.ladysnake.cca.api.v3.component.load.ClientUnloadAwareComponent;
3636
import org.ladysnake.cca.api.v3.component.load.ServerLoadAwareComponent;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import net.minecraft.server.level.ServerPlayer;
3333
import org.jetbrains.annotations.ApiStatus;
3434
import org.jetbrains.annotations.Contract;
35-
import org.jetbrains.annotations.Nullable;
35+
import org.jspecify.annotations.Nullable;
3636
import org.ladysnake.cca.api.v3.component.sync.AutoSyncedComponent;
3737
import org.ladysnake.cca.api.v3.component.sync.ComponentPacketWriter;
3838
import org.ladysnake.cca.api.v3.component.sync.PlayerSyncPredicate;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import net.minecraft.network.RegistryFriendlyByteBuf;
2727
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
2828
import net.minecraft.server.level.ServerPlayer;
29-
import org.jetbrains.annotations.Nullable;
29+
import org.jspecify.annotations.Nullable;
3030
import org.ladysnake.cca.api.v3.component.sync.AutoSyncedComponent;
3131
import org.ladysnake.cca.api.v3.component.sync.PlayerSyncPredicate;
3232
import org.ladysnake.cca.internal.base.ComponentUpdatePayload;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentRegistry.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
package org.ladysnake.cca.api.v3.component;
2424

2525
import net.minecraft.resources.Identifier;
26-
import org.jetbrains.annotations.ApiStatus;
2726
import org.jetbrains.annotations.Contract;
27+
import org.jspecify.annotations.Nullable;
2828
import org.ladysnake.cca.api.v8.component.CardinalComponent;
2929
import org.ladysnake.cca.internal.base.ComponentRegistryImpl;
3030

31-
import javax.annotation.Nullable;
3231
import java.util.stream.Stream;
3332

3433
/**
@@ -41,7 +40,6 @@
4140
* @see ComponentKey
4241
* @since 2.7.0
4342
*/
44-
@ApiStatus.NonExtendable
4543
public final class ComponentRegistry {
4644
/**
4745
* Get a component key for the given identifier and class, or create one if it does not exist.

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/ComponentRegistryV3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import net.minecraft.resources.Identifier;
2626
import org.jetbrains.annotations.ApiStatus;
2727
import org.jetbrains.annotations.Contract;
28+
import org.jspecify.annotations.Nullable;
2829
import org.ladysnake.cca.api.v8.component.CardinalComponent;
2930
import org.ladysnake.cca.internal.base.ComponentRegistryImpl;
3031

31-
import javax.annotation.Nullable;
3232
import java.util.stream.Stream;
3333

3434
/**

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/TransientComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import net.minecraft.world.level.storage.ValueInput;
2626
import net.minecraft.world.level.storage.ValueOutput;
27-
import org.jetbrains.annotations.Nullable;
27+
import org.jspecify.annotations.Nullable;
2828
import org.ladysnake.cca.api.v8.component.CardinalComponent;
2929

3030
/**

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/load/package-info.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
2323
@ApiStatus.Experimental
24-
@MethodsReturnNonnullByDefault
25-
@ParametersAreNonnullByDefault
24+
@NullMarked
2625
package org.ladysnake.cca.api.v3.component.load;
2726

2827
import org.jetbrains.annotations.ApiStatus;
29-
import org.ladysnake.cca.api.v3.util.MethodsReturnNonnullByDefault;
30-
31-
import javax.annotation.ParametersAreNonnullByDefault;
28+
import org.jspecify.annotations.NullMarked;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/package-info.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
23-
@MethodsReturnNonnullByDefault
24-
@ParametersAreNonnullByDefault
23+
@NullMarked
2524
package org.ladysnake.cca.api.v3.component;
2625

27-
import org.ladysnake.cca.api.v3.util.MethodsReturnNonnullByDefault;
28-
29-
import javax.annotation.ParametersAreNonnullByDefault;
26+
import org.jspecify.annotations.NullMarked;

cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/util/MethodsReturnNonnullByDefault.java renamed to cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/sync/package-info.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,9 @@
2020
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
23-
package org.ladysnake.cca.api.v3.util;
23+
@ApiStatus.Experimental
24+
@NullMarked
25+
package org.ladysnake.cca.api.v3.component.sync;
2426

25-
import javax.annotation.Nonnull;
26-
import javax.annotation.meta.TypeQualifierDefault;
27-
import java.lang.annotation.Documented;
28-
import java.lang.annotation.ElementType;
29-
import java.lang.annotation.Retention;
30-
import java.lang.annotation.RetentionPolicy;
31-
32-
/**
33-
* This annotation can be applied to a package, class or method to indicate that
34-
* the method in that element are nonnull by default unless there is:
35-
* <ul>
36-
* <li>An explicit nullness annotation
37-
* <li>The method overrides a method in a superclass (in which case the
38-
* annotation of the corresponding method in the superclass applies)
39-
* <li> there is a default parameter annotation applied to a more tightly nested
40-
* element.
41-
* </ul>
42-
*
43-
*/
44-
@Documented
45-
@Nonnull
46-
@TypeQualifierDefault(ElementType.METHOD) // Note: This is a copy of javax.annotation.ParametersAreNonnullByDefault with target changed to METHOD
47-
@Retention(RetentionPolicy.RUNTIME)
48-
public @interface MethodsReturnNonnullByDefault {}
27+
import org.jetbrains.annotations.ApiStatus;
28+
import org.jspecify.annotations.NullMarked;

0 commit comments

Comments
 (0)