Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Commit f2af06f

Browse files
authored
[Xamarin.Android.Tools.AndroidSdk] Fix a few nullability warnings (#97)
Fixes a few Nullable Reference Type (NRT) warnings in `JdkInfoVersionComparer`. There are also some NRT warnings in `EqualityComparer<T>`, but this class is `private` and not used anywhere; remove it instead.
1 parent 5718cd2 commit f2af06f

2 files changed

Lines changed: 2 additions & 24 deletions

File tree

‎src/Xamarin.Android.Tools.AndroidSdk/AndroidVersions.cs‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -184,26 +184,4 @@ static bool MatchesId (AndroidVersion version, string id)
184184
},
185185
};
186186
}
187-
188-
classEqualityComparer<T>:IEqualityComparer<T>
189-
{
190-
Func<T,T,bool>equals;
191-
Func<T,int>getHashCode;
192-
193-
publicEqualityComparer(Func<T,T,bool>equals,Func<T,int>?getHashCode=null)
194-
{
195-
this.equals=equals;
196-
this.getHashCode=getHashCode??(v =>v?.GetHashCode()??0);
197-
}
198-
199-
publicboolEquals(Tx,Ty)
200-
{
201-
returnequals(x,y);
202-
}
203-
204-
publicintGetHashCode(Tobj)
205-
{
206-
returngetHashCode(obj);
207-
}
208-
}
209187
}

‎src/Xamarin.Android.Tools.AndroidSdk/JdkInfo.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ class JdkInfoVersionComparer : IComparer<JdkInfo>
492492
{
493493
publicstaticreadonlyIComparer<JdkInfo>Default=newJdkInfoVersionComparer();
494494

495-
publicintCompare(JdkInfox,JdkInfoy)
495+
publicintCompare([AllowNull]JdkInfox,[AllowNull]JdkInfoy)
496496
{
497-
if(x.Version!=null&&y.Version!=null)
497+
if(x?.Version!=null&&y?.Version!=null)
498498
returnx.Version.CompareTo(y.Version);
499499
return0;
500500
}

0 commit comments

Comments
 (0)