diff --git a/src/Lucene.Net/Index/SortedSetDocValuesWriter.cs b/src/Lucene.Net/Index/SortedSetDocValuesWriter.cs index 568fb0c76a..34eb99b4fb 100644 --- a/src/Lucene.Net/Index/SortedSetDocValuesWriter.cs +++ b/src/Lucene.Net/Index/SortedSetDocValuesWriter.cs @@ -1,6 +1,7 @@ using Lucene.Net.Diagnostics; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace Lucene.Net.Index @@ -201,9 +202,10 @@ private IEnumerable GetValuesEnumerable(int valueCount, int[] sortedVa } } + [SuppressMessage("ReSharper", "AccessToStaticMemberViaDerivedType", Justification = "Matches Lucene")] private IEnumerable GetOrdCountEnumerable(int maxDoc) { - var iter = pendingCounts.GetIterator(); + AppendingDeltaPackedInt64Buffer.Iterator iter = pendingCounts.GetIterator(); if (Debugging.AssertsEnabled) Debugging.Assert(pendingCounts.Count == maxDoc, "MaxDoc: {0}, pending.Count: {1}", maxDoc, pending.Count); @@ -213,11 +215,12 @@ private IEnumerable GetValuesEnumerable(int valueCount, int[] sortedVa } } + [SuppressMessage("ReSharper", "AccessToStaticMemberViaDerivedType", Justification = "Matches Lucene")] private IEnumerable GetOrdsEnumerable(int[] ordMap, int maxCountPerDoc) { int currentUpTo = 0, currentLength = 0; - var iter = pending.GetIterator(); - var counts = pendingCounts.GetIterator(); + AppendingPackedInt64Buffer.Iterator iter = pending.GetIterator(); + AppendingDeltaPackedInt64Buffer.Iterator counts = pendingCounts.GetIterator(); int[] cd = new int[maxCountPerDoc]; // LUCENENET specific - renamed from currentDoc to cd to prevent conflict for (long ordUpto = 0; ordUpto < pending.Count; ++ordUpto) diff --git a/src/Lucene.Net/Support/CRC32.cs b/src/Lucene.Net/Support/CRC32.cs index 0dbb5720ea..571e52f01a 100644 --- a/src/Lucene.Net/Support/CRC32.cs +++ b/src/Lucene.Net/Support/CRC32.cs @@ -23,9 +23,10 @@ namespace Lucene.Net.Support { internal class CRC32 : IChecksum { - private static readonly uint[] crcTable = InitializeCRCTable(); + private static readonly uint[] crcTable = LoadCRCTable(); - private static uint[] InitializeCRCTable() + // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006) + private static uint[] LoadCRCTable() { uint[] result = new uint[256]; for (uint n = 0; n < 256; n++)