Commit d0231c5
authored
[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)1 parent e1121ea commit d0231c5
File tree
2 files changed
+53
-0
lines changed- tests/generator-Tests/Unit-Tests
- tools/generator/Java.Interop.Tools.Generator.ObjectModel
2 files changed
+53
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
1123 | 1167 | | |
1124 | 1168 | | |
1125 | 1169 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
| |||
0 commit comments