Skip to content

Conversation

bruno-garcia
Copy link
Member

@bruno-garcia bruno-garcia commented Aug 9, 2025

Building now creates lots of warnings.

Build succeeded with 1524 warning(s) in 5.4s

Even though the solution had TreatWarningAsErrors, the build passes, which means these warnings are not 'normal' and sneak in and grow over time.

I'm ignoring all warnings that we can't take action (trusting Cursor pretty much on those claims).
But after a few iterations, I couldn't get these types of warnings to break the build, so if new ones are introduced, it'll take someone paying attention and ignoring them explicitly.

Before:

obj/Debug/net9.0-android35.0/api.xml(5156,8): warning BG8701: Invalid return type 'io.sentry.IScope' for member 'Sentry.JavaSdk.Scopes.GetGlobalScope ()'.
      obj/Debug/net9.0-android35.0/api.xml(5157,8): warning BG8701: Invalid return type 'io.sentry.IScope' for member 'Sentry.JavaSdk.Scopes.GetIsolationScope (
      )'.
      obj/Debug/net9.0-android35.0/api.xml(5160,8): warning BG8701: Invalid return type 'io.sentry.IScopes' for member 'Sentry.JavaSdk.Scopes.GetParentScopes ()
      '.
      obj/Debug/net9.0-android35.0/api.xml(5162,8): warning BG8701: Invalid return type 'io.sentry.IScope' for member 'Sentry.JavaSdk.Scopes.GetScope ()'.
      obj/Debug/net9.0-android35.0/api.xml(5167,10): warning BG8801: Invalid parameter type 'io.sentry.IScopes' for member 'Sentry.JavaSdk.Scopes.IsAncestorOf (
      Sentry.JavaSdk.IScopes)'.
      obj/Debug/net9.0-android35.0/api.xml(5219,10): warning BG8801: Invalid parameter type 'io.sentry.ScopeCallback' for member 'Sentry.JavaSdk.Scopes.WithIsol
      ationScope (Sentry.JavaSdk.IScopeCallback)'.
      obj/Debug/net9.0-android35.0/api.xml(5222,10): warning BG8801: Invalid parameter type 'io.sentry.ScopeCallback' for member 'Sentry.JavaSdk.Scopes.WithScop
      e (Sentry.JavaSdk.IScopeCallback)'.
      obj/Debug/net9.0-android35.0/api.xml(5062,10): warning BG8801: Invalid parameter type 'io.sentry.IScope' for member 'Sentry.JavaSdk.Scopes.Scopes (Sentry.
      JavaSdk.IScope, io.sentry.IScope, io.sentry.IScope, java.lang.String)'.
      obj/

Cursors claims:
Turns out there's not much we can do about these, so we'll ignore them

  • Enable TreatWarningsAsErrors for Android bindings project reverted
  • Suppress expected/unavoidable Android binding warnings (BG8xxx codes)
  • These warnings are caused by Java interface circular dependencies in Sentry SDK
  • Warnings are documented with explanations for each type
  • New warning types will now break the build for review not true
  • Analyzed 1528 warnings and confirmed they're due to binding limitations
  • Solution preserves existing Metadata.xml strategic type removals

#skip-changelog

…warnings

- Enable TreatWarningsAsErrors for Android bindings project
- Suppress expected/unavoidable Android binding warnings (BG8xxx codes)
- These warnings are caused by Java interface circular dependencies in Sentry SDK
- Warnings are documented with explanations for each type
- New warning types will now break the build for review
- Analyzed 1528 warnings and confirmed they're due to binding limitations
- Solution preserves existing Metadata.xml strategic type removals
<!-- BG8604: Missing ancestor types - nested types whose parents are removed -->
<!-- BG8502: Interface invalidation - cascade effect from other binding issues -->
<!-- BG8401/BG8400: Field/property conflicts - resolved individually in Metadata.xml where needed -->
<NoWarn>$(NoWarn);BG8801;BG8C01;BG8701;BG8800;BG8700;BG8605;BG8606;BG8604;BG8502;BG8401;BG8400;BG8503;BG8C00</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: also mention BG8503 and BG8C00 in the comments

Copy link
Member Author

@bruno-garcia bruno-garcia Aug 11, 2025

Choose a reason for hiding this comment

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

What should I add as a comment?
Unless there's a plan to fix them, I just want all warnings gone. Should we leave the warnings on the terminal?
Doesn't seem like any of this is worth doing anything about since we're not binding the whole library and it works as inteded

Copy link
Member

@Flash0ver Flash0ver Aug 12, 2025

Choose a reason for hiding this comment

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

I was thinking about a short description of these warning for completeness.

I added (non-blocking) suggestions.

<!-- BG8801: Invalid parameter types - caused by circular interface dependencies in Sentry Java SDK -->
<!-- BG8C01: Invalid base interface - interfaces reference types removed by Metadata.xml -->
<!-- BG8701: Invalid return types - return types reference unresolvable interfaces -->
<!-- BG8800/BG8700: Unknown/Invalid types - types intentionally removed by Metadata.xml -->
Copy link
Member

@Flash0ver Flash0ver Aug 12, 2025

Choose a reason for hiding this comment

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

Suggested change
<!-- BG8800/BG8700: Unknown/Invalid types - types intentionally removed by Metadata.xml -->
<!-- BG8800/BG8700: Unknown parameter/return types - types intentionally removed by Metadata.xml -->

Invalid parameter/return types are BG8801/BG8701.

@jamescrosswell jamescrosswell merged commit ebaeb6b into main Aug 15, 2025
32 checks passed
@jamescrosswell jamescrosswell deleted the fix-android-binding-warnings branch August 15, 2025 03:07
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.

3 participants