NightOwl888 commented on code in PR #1056:
URL: https://github.com/apache/lucenenet/pull/1056#discussion_r1883183885


##########
src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs:
##########
@@ -67,6 +67,42 @@ public int CompareTo(Completion o)
             {
                 return this.Utf8.CompareTo(o.Utf8);
             }
+
+            // LUCENENET specific - per CS0660 and CS0661, we need to override 
Equals and GetHashCode
+            public override bool Equals(object obj) => ReferenceEquals(this, 
obj);
+
+            public override int GetHashCode()
+            {
+                unchecked

Review Comment:
   Please cascade the call to the base class.
   
   ```c#
   public override int GetHashCode() => base.GetHashCode();
   ```



##########
src/Lucene.Net.Suggest/Suggest/Lookup.cs:
##########
@@ -122,14 +122,53 @@ public int CompareTo(LookupResult o)
             {
                 return CHARSEQUENCE_COMPARER.Compare(Key, o.Key);
             }
+
+            // LUCENENET specific - per CS0660 and CS0661, we need to override 
Equals and GetHashCode
+            public override bool Equals(object obj) => ReferenceEquals(this, 
obj);

Review Comment:
   Please cascade the call to the base class.
   
   ```c#
   public override bool Equals(object obj) => base.Equals(obj);
   ```



##########
src/Lucene.Net/Util/Automaton/State.cs:
##########
@@ -360,17 +360,44 @@ public virtual int CompareTo(State s)
             return s.id - id;
         }
 
-        // LUCENENET NOTE: DO NOT IMPLEMENT Equals()!!!
+        // LUCENENET NOTE: DO NOT IMPLEMENT Equals() with structural 
equality!!!
         // Although it doesn't match GetHashCode(), checking for
         // reference equality is by design.
         // Implementing Equals() causes difficult to diagnose
         // IndexOutOfRangeExceptions when using FuzzyTermsEnum.
         // See GH-296.
+        // Overriding here to prevent CS0660 warning due to defining the == 
operator.
+        public override bool Equals(object obj) => ReferenceEquals(this, obj);

Review Comment:
   Please cascade the call to the base class.
   
   ```c#
   public override bool Equals(object obj) => base.Equals(obj);
   ```



##########
src/Lucene.Net.Suggest/Suggest/Lookup.cs:
##########
@@ -122,14 +122,53 @@ public int CompareTo(LookupResult o)
             {
                 return CHARSEQUENCE_COMPARER.Compare(Key, o.Key);
             }
+
+            // LUCENENET specific - per CS0660 and CS0661, we need to override 
Equals and GetHashCode
+            public override bool Equals(object obj) => ReferenceEquals(this, 
obj);
+
+            public override int GetHashCode()

Review Comment:
   Please cascade the call to the base class.
   
   ```c#
   public override int GetHashCode() => base.GetHashCode();
   ```



##########
src/Lucene.Net.QueryParser/Surround/Query/SimpleTerm.cs:
##########
@@ -2,6 +2,7 @@
 using Lucene.Net.Index;
 using System;
 using System.Text;
+#pragma warning disable CS0660, CS0661 - CompareTo is deprecated, so skipping 
implementing equality members (lucenenet#683)

Review Comment:
   Please fix the inline comment by preceeding with `//`.



##########
src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs:
##########
@@ -67,6 +67,42 @@ public int CompareTo(Completion o)
             {
                 return this.Utf8.CompareTo(o.Utf8);
             }
+
+            // LUCENENET specific - per CS0660 and CS0661, we need to override 
Equals and GetHashCode
+            public override bool Equals(object obj) => ReferenceEquals(this, 
obj);

Review Comment:
   Please cascade the call to the base class.
   
   ```c#
   public override bool Equals(object obj) => base.Equals(obj);
   ```



##########
src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs:
##########
@@ -470,6 +470,31 @@ public override bool Equals(object obj)
                 return true;
             }
 
+            #region Operator overrides
+            #nullable enable

Review Comment:
   By default, Visual Studio left aligns `#nullable enable` and `#nullable 
restore`, so please do that in each case in this PR.



-- 
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