Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Enchancement: Support @SentrySpan and @SentryTransaction on classes and interfaces. (#1243)
* Enchancement: Do not serialize empty collections and maps (#1245)
* Ref: Simplify RestTemplate instrumentation (#1246)
* Enchancement: Integration interface better compatibility with Kotlin null-safety

# 4.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class SentryAutoConfigurationTest {
}

class CustomIntegration : Integration {
override fun register(hub: IHub?, options: SentryOptions?) {}
override fun register(hub: IHub, options: SentryOptions) {}
}

@Configuration(proxyBeanMethods = false)
Expand Down
4 changes: 3 additions & 1 deletion sentry/src/main/java/io/sentry/Integration.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.sentry;

import org.jetbrains.annotations.NotNull;

/**
* Code that provides middlewares, bindings or hooks into certain frameworks or environments, along
* with code that inserts those bindings and activates them.
Expand All @@ -11,5 +13,5 @@ public interface Integration {
* @param hub the Hub
* @param options the options
*/
void register(IHub hub, SentryOptions options);
void register(@NotNull IHub hub, @NotNull SentryOptions options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/** Sends cached events over when your App. is starting. */
public final class SendCachedEnvelopeFireAndForgetIntegration implements Integration {

private final SendFireAndForgetFactory factory;
private final @NotNull SendFireAndForgetFactory factory;

public interface SendFireAndForget {
void send();
Expand All @@ -21,7 +21,7 @@ public interface SendFireAndForgetDirPath {

public interface SendFireAndForgetFactory {
@Nullable
SendFireAndForget create(IHub hub, SentryOptions options);
SendFireAndForget create(@NotNull IHub hub, @NotNull SentryOptions options);

default boolean hasValidPath(final @Nullable String dirPath, final @NotNull ILogger logger) {
if (dirPath == null || dirPath.isEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions sentry/src/test/java/io/sentry/HubTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,9 @@ class HubTest {
doAnswer {
val hub = it.arguments[0] as IHub
assertTrue(hub.isEnabled)
}.whenever(mock).register(any(), eq(options))
}.whenever(mock).register(any(), eq(options!!))

verify(mock).register(any(), eq(options))
verify(mock).register(any(), eq(options!!))
}

//region setLevel tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SendCachedEnvelopeFireAndForgetIntegrationTest {
}

private class CustomFactory : SendCachedEnvelopeFireAndForgetIntegration.SendFireAndForgetFactory {
override fun create(hub: IHub?, options: SentryOptions?): SendCachedEnvelopeFireAndForgetIntegration.SendFireAndForget? {
override fun create(hub: IHub, options: SentryOptions): SendCachedEnvelopeFireAndForgetIntegration.SendFireAndForget? {
return null
}
}
Expand Down