You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/05 16:51:56 UTC

[21/27] lucenenet git commit: Lucene.Net.Core.Util.FieldCacheSanityChecker.ReaderField refactor: Changed to use RuntimeHelpers.GetHashCode(), which is the equivalent of Java's System.identityHashCode() method

Lucene.Net.Core.Util.FieldCacheSanityChecker.ReaderField refactor: Changed to use RuntimeHelpers.GetHashCode(), which is the equivalent of Java's System.identityHashCode() method


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/efd894b8
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/efd894b8
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/efd894b8

Branch: refs/heads/api-work
Commit: efd894b8a7bb046707afd8e2fb92ffe54abf7b26
Parents: 460e55e
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Feb 5 18:23:31 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Feb 5 18:23:31 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/efd894b8/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
index 8a0fc7f..cbb93ef 100644
--- a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
+++ b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
@@ -2,7 +2,7 @@ using Lucene.Net.Search;
 using Lucene.Net.Support;
 using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
-using System.Linq;
+using System.Runtime.CompilerServices;
 using System.Text;
 
 namespace Lucene.Net.Util
@@ -322,18 +322,22 @@ namespace Lucene.Net.Util
         /// </summary>
         private sealed class ReaderField
         {
-            public object ReaderKey { get; private set; }
+            public object ReaderKey
+            {
+                get { return readerKey; }
+            }
+            private readonly object readerKey;
             public string FieldName { get; private set; }
 
             public ReaderField(object readerKey, string fieldName)
             {
-                this.ReaderKey = readerKey;
+                this.readerKey = readerKey;
                 this.FieldName = fieldName;
             }
 
             public override int GetHashCode()
             {
-                return ReaderKey.GetHashCode() * FieldName.GetHashCode(); // LUCENENET TODO: IdentityHashCode
+                return RuntimeHelpers.GetHashCode(readerKey) * FieldName.GetHashCode();
             }
 
             public override bool Equals(object that)
@@ -344,12 +348,12 @@ namespace Lucene.Net.Util
                 }
 
                 ReaderField other = (ReaderField)that;
-                return (this.ReaderKey == other.ReaderKey && this.FieldName.Equals(other.FieldName));
+                return (this.readerKey == other.readerKey && this.FieldName.Equals(other.FieldName));
             }
 
             public override string ToString()
             {
-                return ReaderKey.ToString() + "+" + FieldName;
+                return readerKey.ToString() + "+" + FieldName;
             }
         }