Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Sep 8, 2025

📜 Description

#skip-changelog

Add animalsniffer to check the source files in the main directories of plain Java repositories. The signature in coreLib2 allows classes and methods in the Android API and JDK APIs available through desugaring. Using a less permissive signature that does not allow desugaring causes failures, so I opted for coreLib2 for now.

Closes #4679
Closes JAVA-156

💡 Motivation and Context

Prevent issues like #4651 reaching users.

The animalsnifferMain task would have failed the responsible PR: #4604.

💚 How did you test it?

Run ./gradlew animalsnifferMain.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Sep 8, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 383.27 ms 445.83 ms 62.57 ms
Size 1.58 MiB 2.10 MiB 532.98 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
c8125f3 383.82 ms 441.66 ms 57.84 ms
85d7417 347.21 ms 394.35 ms 47.15 ms
ce0a49e 532.00 ms 609.96 ms 77.96 ms
1df7eb6 397.04 ms 429.64 ms 32.60 ms
7314dbe 437.83 ms 505.64 ms 67.81 ms
ee747ae 554.98 ms 611.50 ms 56.52 ms
b750b96 421.25 ms 444.09 ms 22.84 ms
ee747ae 382.73 ms 435.41 ms 52.68 ms
ee747ae 358.21 ms 389.41 ms 31.20 ms
674d437 355.28 ms 504.18 ms 148.90 ms

App size

Revision Plain With Sentry Diff
c8125f3 1.58 MiB 2.10 MiB 532.32 KiB
85d7417 1.58 MiB 2.10 MiB 533.44 KiB
ce0a49e 1.58 MiB 2.10 MiB 532.94 KiB
1df7eb6 1.58 MiB 2.10 MiB 532.97 KiB
7314dbe 1.58 MiB 2.10 MiB 533.45 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
b750b96 1.58 MiB 2.10 MiB 533.20 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
674d437 1.58 MiB 2.10 MiB 530.94 KiB

Previous results on branch: webb/animalsniffer

Startup times

Revision Plain With Sentry Diff
25d5617 387.37 ms 451.94 ms 64.57 ms
6284e75 339.72 ms 384.49 ms 44.77 ms
9a790dc 361.04 ms 422.85 ms 61.81 ms

App size

Revision Plain With Sentry Diff
25d5617 1.58 MiB 2.10 MiB 533.20 KiB
6284e75 1.58 MiB 2.10 MiB 532.97 KiB
9a790dc 1.58 MiB 2.10 MiB 533.20 KiB

Copy link

linear bot commented Sep 9, 2025

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🎉
I imagine this also runs in CI during the build, right?
I'll defer to the Android team for approval as I don't know enough about this topic.

@@ -31,6 +32,9 @@ dependencies {
testImplementation(libs.msgpack)
testImplementation(libs.okio)
testImplementation(projects.sentryTestSupport)

val gummyBearsModule = libs.gummy.bears.api21.get().module
signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}:coreLib2@signature")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, we cannot guarantee that core-library desugaring is enabled by our customers, so we have to be conservative here and test against the plain Android APIs assuming there's no desugaring and our SDK should still work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the failures you're experiencing? If it fails, we should actually fix those

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one task fails when I use the list of modules you gave below. Do these need to be fixed?

> Task :sentry:animalsnifferMain FAILED

[Undefined reference] io.sentry.(SentryInstantDate.java:1) #date
  >> java.time.Instant

[Undefined reference] io.sentry.(SentryInstantDate.java:16)
  >> java.time.Instant java.time.Instant.now()

[Undefined reference] io.sentry.(SentryInstantDate.java:26)
  >> long java.time.Instant.getEpochSecond()

[Undefined reference] io.sentry.(SentryInstantDate.java:26)
  >> int java.time.Instant.getNano()

[Undefined reference] io.sentry.(SentryWrapper.java:54)
  >> java.util.function.Supplier

[Undefined reference] io.sentry.(SentryWrapper.java:56)
  >> Object java.util.function.Supplier.get()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to suppress these? For Instant we actually have a check on Android if it's available (API 26+) and then use it, for SentryWrapper - it's not used unless the customers use it, which won't be the case for Android (Virtual Threads is not available I believe).

Copy link
Contributor Author

@alexander-alderman-webb alexander-alderman-webb Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the context!

I added config to ignore all java.time.Instant warnings and exclude SentryWrapper.java from the check.

Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very impactful change, thanks!

@alexander-alderman-webb alexander-alderman-webb merged commit 3d205d0 into main Sep 18, 2025
45 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/animalsniffer branch September 18, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint use of JDK APIs unavailable in Android
4 participants