Skip to content

Commit

Permalink
[Mono.Android] Remove System.Linq usage (#7210)
Browse files Browse the repository at this point in the history
Fixes: #5442

Remove all `using System.Linq` statements and all use of LINQ
extension methods from `Mono.Android.dll`.

Primary motivation was to reduce `.apk` size (09baa52), and we don't
want to inadvertently allow LINQ usage back in…
  • Loading branch information
jonpryor authored Jul 27, 2022
1 parent 3ded9a8 commit de836a8
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/Mono.Android/Android.Graphics/Color.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Android.Runtime/AndroidEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Net;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net.Security;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Android.Runtime/AndroidRuntime.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
Expand Down
1 change: 0 additions & 1 deletion src/Mono.Android/Android.Runtime/CharSequence.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;

Expand Down
2 changes: 0 additions & 2 deletions src/Mono.Android/Android.Runtime/JNIEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
Expand Down
5 changes: 3 additions & 2 deletions src/Mono.Android/Android.Runtime/JavaArray.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


namespace Android.Runtime {
Expand Down Expand Up @@ -108,7 +107,9 @@ public static IntPtr ToLocalJniHandle (IList<T>? value)
if (c != null)
return JNIEnv.ToLocalJniHandle (c);

var a = value.ToArray ();
var a = new T [value.Count];
value.CopyTo (a, 0);

return JNIEnv.NewArray (a, typeof (T));
}
}
Expand Down

0 comments on commit de836a8

Please sign in to comment.