paulirwin commented on code in PR #1124:
URL: https://github.com/apache/lucenenet/pull/1124#discussion_r2354180023


##########
src/Lucene.Net/Support/Collections.cs:
##########
@@ -227,22 +195,22 @@ public static ReadOnlyDictionary<TKey, TValue> 
AsReadOnly<TKey, TValue>(IDiction
 
         #region ReverseComparer
 
-        private class ReverseComparer<T> : IComparer<T>
+        private class ReverseComparer<T> : IComparer<T?>
         {
             internal static readonly ReverseComparer<T> REVERSE_ORDER = new 
ReverseComparer<T>();
 
-            public int Compare(T x, T y)
+            public int Compare(T? x, T? y)
             {
                 // LUCENENET specific: Use J2N's Comparer<T> to mimic Java 
comparison behavior
-                return JCG.Comparer<T>.Default.Compare(y, x);
+                return JCG.Comparer<T?>.Default.Compare(y, x);

Review Comment:
   That works in i.e. .NET 8, but .NET Framework 4.6.2's compiler warns about 
the parameters if you remove the nullability from the comparer type. Leaving 
as-is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to