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 @@ -6,6 +6,7 @@

- Deduplicate events happening in multiple threads simultaneously (e.g. `OutOfMemoryError`) ([#2845](https://github.com/getsentry/sentry-java/pull/2845))
- This will improve Crash-Free Session Rate as we no longer will send multiple Session updates with `Crashed` status, but only the one that is relevant
- Ensure no Java 8 method reference sugar is used for Android ([#2857](https://github.com/getsentry/sentry-java/pull/2857))

## 6.26.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ final class ANRWatchDog extends Thread {
@NotNull ANRListener listener,
@NotNull ILogger logger,
final @NotNull Context context) {
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
this(
() -> SystemClock.uptimeMillis(),
timeoutIntervalMillis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public void close() throws IOException {
} else {
// some versions of the androidx lifecycle-process require this to be executed on the main
// thread.
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
handler.post(() -> removeObserver());
}
}
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/HostnameCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ private HostnameCache() {
}

HostnameCache(long cacheDuration) {
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
this(cacheDuration, () -> InetAddress.getLocalHost());
}

Expand Down
8 changes: 6 additions & 2 deletions sentry/src/main/java/io/sentry/JsonObjectDeserializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,17 @@ private void parse(@NotNull JsonObjectReader reader) throws IOException {
pushCurrentToken(new TokenName(reader.nextName()));
break;
case STRING:
done = handlePrimitive(reader::nextString);
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
done = handlePrimitive(() -> reader.nextString());
break;
case NUMBER:
done = handlePrimitive(() -> nextNumber(reader));
break;
case BOOLEAN:
done = handlePrimitive(reader::nextBoolean);
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
done = handlePrimitive(() -> reader.nextBoolean());
break;
case NULL:
reader.nextNull();
Expand Down
18 changes: 12 additions & 6 deletions sentry/src/main/java/io/sentry/SentryEnvelopeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public final class SentryEnvelopeItem {
new SentryEnvelopeItemHeader(
SentryItemType.Session, () -> cachedItem.getBytes().length, "application/json", null);

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down Expand Up @@ -124,7 +125,8 @@ public final class SentryEnvelopeItem {
"application/json",
null);

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down Expand Up @@ -161,7 +163,8 @@ public static SentryEnvelopeItem fromUserFeedback(
"application/json",
null);

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down Expand Up @@ -206,7 +209,8 @@ public static SentryEnvelopeItem fromAttachment(
attachment.getFilename(),
attachment.getAttachmentType());

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down Expand Up @@ -271,7 +275,8 @@ private static void ensureAttachmentSizeLimit(
"application-json",
traceFile.getName());

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down Expand Up @@ -340,7 +345,8 @@ private static byte[] readBytesFromFile(String pathname, long maxFileLength)
"application/json",
null);

// Don't use method reference. This can cause issues on Android
// avoid method refs on Android due to some issues with older AGP setups
// noinspection Convert2MethodRef
return new SentryEnvelopeItem(itemHeader, () -> cachedItem.getBytes());
}

Expand Down