Skip to content

Commit 6a9778f

Browse files
committed
Fix null! and empty catch
1 parent 463e990 commit 6a9778f

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ModelBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static TypeMapAssemblyData Build (IReadOnlyList<JavaPeerInfo> peers, stri
5050
// Invoker types are NOT emitted as separate proxies or TypeMap entries —
5151
// they only appear as a TypeRef in the interface proxy's get_InvokerType property.
5252
var invokerTypeNames = new HashSet<string> (
53-
peers.Where (p => p.InvokerTypeName != null).Select (p => p.InvokerTypeName!),
53+
peers.Where (p => p.InvokerTypeName != null).Select (p => p.InvokerTypeName ?? ""),
5454
StringComparer.Ordinal);
5555

5656
// Group non-invoker peers by JNI name to detect aliases (multiple .NET types → same Java class).

tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/FixtureTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ private protected static string CreateTempDir ()
137137
private protected static void DeleteTempDir (string dir)
138138
{
139139
if (Directory.Exists (dir))
140-
try { Directory.Delete (dir, true); } catch { }
140+
try { Directory.Delete (dir, true); } catch (IOException) { }
141141
}
142142
}

tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/TypeMapModelBuilderTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,8 @@ public void Fixture_MainActivity_UcoMethods ()
788788
{
789789
var peer = FindFixtureByJavaName ("my/app/MainActivity");
790790
var model = BuildModel (new [] { peer }, "TypeMap");
791-
var proxy = FindProxy (model, "MyApp_MainActivity_Proxy")!;
791+
var proxy = FindProxy (model, "MyApp_MainActivity_Proxy");
792+
Assert.NotNull (proxy);
792793

793794
var nonCtorMethods = peer.MarshalMethods.Where (m => !m.IsConstructor).ToList ();
794795
Assert.Equal (nonCtorMethods.Count, proxy.UcoMethods.Count);

0 commit comments

Comments
 (0)