You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[generator] Override methods should match base deprecated info (#1130)
There are several warnings when building `Mono.Android.dll` related
to `[Obsolete]` methods, e.g.:
warning CS0672: Member 'MediaRouteActionProvider.OnCreateActionView()' overrides obsolete member 'ActionProvider.OnCreateActionView()'.
Add the Obsolete attribute to 'MediaRouteActionProvider.OnCreateActionView()'
Technically, `MediaRouteActionProvider.onCreateActionView()` is only
marked as `deprecated` in the [docs][0], but not in `android.jar`:
public class MediaRouteActionProvider extends ActionProvider {
public View onCreateActionView() {
throw new RuntimeException("Stub!");
}
}
Regardless, any method that overrides a deprecated method should
itself be marked as deprecated.
Another case specific to `Mono.Android.dll` is
[`ContextWrapper.setWallpaper()`][1]. This method is marked as
`deprecated-since`=23, but the base method is marked as
`deprecated-since`=16. This causes us to generate:
public class Context {
[Obsolete]
public virtual void SetWallpaper () { ... }
}
public class ContextWrapper : Context {
[ObsoletedOSPlatform ("android23.0")]
public override void SetWallpaper () { ... }
}
This causes the same CS0672 warning.
Fix the CS0672 warnings by setting the `override` method's
`deprecated-since` to match the base method's `deprecated-since`.
[0]: https://developer.android.com/reference/android/app/MediaRouteActionProvider?hl=en#onCreateActionView()
[1]: https://developer.android.com/reference/android/content/ContextWrapper?hl=en#setWallpaper(android.graphics.Bitmap)
0 commit comments