-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mono.Android.dll] Add support for ObsoletedOSPlatformAttribute
#7234
Milestone
Comments
jonpryor
pushed a commit
to jonpryor/java.interop
that referenced
this issue
Aug 23, 2022
…#1024) Context: dotnet/android#7234 Refactor logic for applying `[Obsolete]` attributes into a single common method. This method will later be extended to add support for [`[ObsoletedOSPlatformAttribute]`][0]. Doing this piece first and separately allows us to verify that the refactor does not break anything, as the existing logic is tricky. A future PR will also remove the temporary hacks used to preserve stylistic compatibility with a `generator` refactor in 6bbb00a. [0]: dotnet/runtime#72970
jonpryor
pushed a commit
to dotnet/java-interop
that referenced
this issue
Aug 23, 2022
Context: dotnet/android#7234 Add support for a new option `generator --lang-features=obsoleted-platform-attributes`. When used, for an API that was obsoleted in API levels greater than our .NET 7 minimum (API-21), we will generate .NET 7's new `[ObsoletedOSPlatform]` attribute *instead of* `[Obsolete]`: // New [global::System.Runtime.Versioning.ObsoletedOSPlatform ("android22.0", @"This class is obsoleted in this android platform")] public partial class CookieSpecParamBean : Org.Apache.Http.Params.HttpAbstractParamBean { } // Previous [global::System.Obsolete (@"This class is obsoleted in this android platform")] public partial class CookieSpecParamBean : Org.Apache.Http.Params.HttpAbstractParamBean { } This is useful in a .NET 7+ context because we always *compile* against the "latest" `Mono.Android`, even if you are *targeting* an earlier version. For example, the use of `[Obsolete]` means that using `CookieSpecParamBean` would always result in a CS0618 obsolete usage warning, even when building with `$(SupportedOSPlatformVersion)`=21. (`CookieSpecParamBean` was obsoleted in API-22.)
jonathanpeppers
pushed a commit
that referenced
this issue
Aug 24, 2022
Fixes: #7234 Changes: dotnet/java-interop@a5756ca...e31d9c6 * dotnet/java-interop@e31d9c62: Context: #7285 (comment) (#1029) * dotnet/java-interop@d3ea180c: [generator] Add support for `[ObsoletedOSPlatform]` (#1026) * dotnet/java-interop@6d1ae4ee: [generator] Remove [Obsolete] style compatibility hacks. (#1025) * dotnet/java-interop@440c05ee: [generator] Refactor logic for applying [Obsolete] attributes (#1024) * dotnet/java-interop@9b1d3ab7: [Localization] Import translated resx files (#1018) `generator` can now emit `[ObsoletedOSPlatformAttribute]`. Requires: - Update `Mono.Android.targets` to pass `lang-feature=obsoleted-platform-attributes` to `generator` when building for .NET 7+ - Update `acceptable-breakages-vReference-net7.0.txt` to account for removing existing `[Obsolete]` attributes in favor of the new ones, for .NET 7+ only
ghost
locked as resolved and limited conversation to collaborators
Sep 23, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Context: #6349
Context: dotnet/runtime#47601
Imagine Android adds a new overload of a method and deprecates the existing method:
If you are compiling against API-33 reference assemblies, there is no reasonable way to consume this API without generating an "obsolete" warning:
In .NET 6 we did not have a good way to express "obsoleted in API X" warnings. In .NET 7
[ObsoletedOSPlatformAttribute]
has been added, allowing us to express this properly.In order to support this, we will need to:
Extend-api-merge
to generateobsoleted-in
dataapi-merge
already generatesdeprecated-since
([api-merge] add deprecation platform information to API description #824)generator
to consume that data and output the new attribute ([generator] Add support for[ObsoletedOSPlatform]
. java-interop#1026)The text was updated successfully, but these errors were encountered: