Skip to content

Commit

Permalink
Bump to xamarin/Java.Interop/main@f8d77fa (#7638)
Browse files Browse the repository at this point in the history
Context: 4da2792
Context: dotnet/java-interop@d3ea180
Context: dotnet/java-interop@15c8879

Changes: dotnet/java-interop@149d70f...f8d77fa

  * dotnet/java-interop@f8d77faf: [generator] Better support deprecated property getter/setters. (dotnet/java-interop#1062)
  * dotnet/java-interop@5e6209ea: [generator] Obsolete&SupportedOSPlatform attributes on enum members (dotnet/java-interop#1066)
  * dotnet/java-interop@15c88797: [generator] Use decl type's @deprecated-since if < member's (dotnet/java-interop#1068)
  * dotnet/java-interop@525a45d5: [Java.Interop.Dynamic-Tests] Use Microsoft.CSharp NuGet package (dotnet/java-interop#1067)

Background: member deprecations can be "historically weird" in Android.
For example, in API-21 [`android/app/ActionBar.TabListener`][0] was
deprecated:

	@deprecated
	/* partial */ interface TabListener {
	    void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft);
	    // …
	}

The type being deprecated means that its members are *implicitly*
deprecated.

In API-29 the members were *explicitly* deprecated:

	@deprecated
	/* partial */ interface TabListener {
	    @deprecated
	    void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft);
	    // …
	}

Before dotnet/java-interop@d3ea180c, this resulted in the binding:

	[Obsolete]
	partial interface ITabListener {
	    [Obsolete]
	    void OnTabReselected(ActionBar.Tab? tab, FragmentTransaction? ft);
	    // …
	}

Commit dotnet/java-interop@d3ea180c added support for
`[ObsoletedOSPlatform]` to `generator`, which *changed* the binding to:

	[Obsolete] // because it was deprecated in our min-supported API-21
	partial interface ITabListener {
	    [ObsoletedOSPlatform ("android29.0")]
	    void OnTabReselected(ActionBar.Tab? tab, FragmentTransaction? ft);
	    // …
	}

This resulted in *lots* of changes in commit 4da2792 to
`tests/api-compatibility/acceptable-breakages-vReference-net7.0.txt`
because `[Obsolete]` was were replaced by `[ObsoletedOSPlatform]`:

	CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.App.ActionBar.ITabListener.OnTabReselected(Android.App.ActionBar.Tab, Android.App.FragmentTransaction)' in the contract but not the implementation

Commit dotnet/java-interop@15c88797 updates type members to have the
same deprecation status as their declaring type, when the member was
deprecated *after* the type was deprecated.  This means we *now*
bind `ITabListener` as:

	[Obsolete] // because it was deprecated in our min-supported API-21
	partial interface ITabListener {
	    [Obsolete]
	    void OnTabReselected(ActionBar.Tab? tab, FragmentTransaction? ft);
	    // …
	}

which matches the state of things pre- dotnet/java-interop@d3ea180c,
which means we no longer need to ignore all those
`CannotRemoveAttribute` messages.  dotnet/java-interop@15c88797 thus
"unintentionally partially reverts" 4da2792 (yay?), simply because
the prior state of affairs in which a member was deprecated *after*
the declaring type, while valid, didn't make any sense.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Pobst <[email protected]>

[0]: https://developer.android.com/reference/android/app/ActionBar.TabListener
  • Loading branch information
dependabot[bot] authored Dec 16, 2022
1 parent 17213ea commit c893add
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 242 deletions.
2 changes: 1 addition & 1 deletion external/Java.Interop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Some enums we import from Mono.Android, like Android.Content.PM.LaunchMode, contain this
// attribute which does not exist in netstandard2.0, thus we'll include our own private copy
// that gets removed at compile time via [Conditional ("NEVER")].

#if !NET
namespace System.Runtime.Versioning
{
[System.Diagnostics.Conditional ("NEVER")]
[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Enum | AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Module | AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
sealed class SupportedOSPlatformAttribute : Attribute
{
public SupportedOSPlatformAttribute (string platformName) { }
}
}
#endif
Loading

0 comments on commit c893add

Please sign in to comment.