Skip to content
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] [Preserve] now has [Obsolete(error:true)] #9109

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<field name="handle_type" />
<field name="refs_added" />
<field name="weak_handle" />
<method name="SetHandleOnDeserialized" />
</type>
<type fullname="Java.Lang.Throwable">
<field name="handle" />
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Android.OS/AsyncTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public AsyncTask ()
JNIEnv.FinishCreateInstance (Handle, class_ref, id_ctor);
}

[Preserve (Conditional = true)]
protected override Java.Lang.Object? DoInBackground (params Java.Lang.Object[]? native_parms)
{
TParams[] parms = new TParams[native_parms?.Length ?? 0];
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Android.Runtime/PreserveAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

namespace Android.Runtime {

[Obsolete ("Please use [System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute]")]
[Obsolete ("Please use [System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute]. https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#dynamicdependency", error: true)]
[AttributeUsage (
AttributeTargets.Class
| AttributeTargets.Struct
Expand Down
2 changes: 0 additions & 2 deletions src/Mono.Android/Android.Runtime/XmlPullParserReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public override void Close ()
source.Close ();
}

[Preserve (Conditional=true)]
public static XmlResourceParserReader? FromJniHandle (IntPtr handle, JniHandleOwnership transfer)
{
return FromNative (handle, transfer);
Expand Down Expand Up @@ -387,7 +386,6 @@ public override string? Value {
}
}

[Preserve (Conditional=true)]
public static XmlReader? FromJniHandle (IntPtr handle, JniHandleOwnership transfer)
{
return FromNative (handle, transfer);
Expand Down
2 changes: 0 additions & 2 deletions src/Mono.Android/Android.Runtime/XmlReaderPullParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Android.Runtime
{
public class XmlReaderResourceParser : XmlReaderPullParser, IXmlResourceParser
{
[Preserve (Conditional=true)]
public static IntPtr ToLocalJniHandle (XmlReader? value)
{
if (value == null)
Expand Down Expand Up @@ -127,7 +126,6 @@ public int StyleAttribute {

public class XmlReaderPullParser : Java.Lang.Object, IXmlPullParser
{
[Preserve (Conditional=true)]
public static IntPtr ToLocalJniHandle (XmlReader? value)
{
if (value == null)
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Java.Lang/Object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public Object (IntPtr handle, JniHandleOwnership transfer)

// Note: must be internal so that e.g. DataContractJsonSerializer will find it
[OnDeserialized]
[Preserve]
internal void SetHandleOnDeserialized (StreamingContext context)
{
if (Handle != IntPtr.Zero)
Expand Down
5 changes: 0 additions & 5 deletions src/Mono.Android/metadata
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,6 @@
<remove-node path="/api/package[@name='junit.framework']/class[@name='TestSuite']/method[parameter[@type='java.lang.Class']]" api-since="16" />
-->

<!-- Preserve Mono.Android.App.IntentService::.ctor if the
type is used anywhere. -->

<attr path="/api/package[@name='mono.android.app']/class[@name='IntentService']/constructor[count(parameter) = 0]" name="customAttributes">[Preserve(Conditional = true)]</attr>

<!-- Asyncification -->

<!-- Interfaces -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ public LinkerClass () { }

public void WasThisMethodPreserved (string arg1) { }

[Android.Runtime.Preserve]
public void PreserveAttribMethod () { }
}
}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CannotChangeAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute'
CannotChangeAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' on 'Android.App.Admin.DevicePolicyManager.LockNow(Android.App.Admin.DevicePolicyManagerFlags)' changed from '[RequiresPermissionAttribute("android.permission.MANAGE_DEVICE_POLICY_LOCK")]' in the contract to '[RequiresPermissionAttribute("android.permission.LOCK_DEVICE")]' in the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' exists on 'Android.Telephony.Euicc.EuiccManager.DeleteSubscription(System.Int32, Android.App.PendingIntent)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' exists on 'Android.Telephony.Euicc.EuiccManager.DownloadSubscription(Android.Telephony.Euicc.DownloadableSubscription, System.Boolean, Android.App.PendingIntent)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.Runtime.PreserveAttribute' in the contract but not the implementation.
Loading