From 5374caacd50ab96d3c1ab97fe3418adc888888a8 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Sat, 18 Jan 2025 13:07:13 -0700 Subject: [PATCH 1/6] SWEEP: PrintStackTrace cleanup, #932 (#1101) * SWEEP: Exception.StackTrace cleanup, #932 * Add unit tests for StackTraceHelper, #932 * Better assert for PrintCurrentStackTrace that caller is the top line * PR feedback * Add string.Contains extension method for .NET Framework and Standard 2.0 * Use MemoryExtensions.Contains * Revert test code to use extension method * Use is null --- Directory.Build.targets | 9 +- src/Lucene.Net.Benchmark/ByTask/Benchmark.cs | 7 +- .../ByTask/Feeds/EnwikiQueryMaker.cs | 2 +- .../ByTask/Feeds/ReutersQueryMaker.cs | 2 +- .../ByTask/Feeds/TrecContentSource.cs | 14 +-- .../Index/CompoundFileExtractor.cs | 6 +- .../ReplicationClient.cs | 3 +- .../Analysis/BaseTokenStreamTestCase.cs | 3 +- .../Lucene3x/PreFlexRWPostingsFormat.cs | 3 +- .../Lucene3x/PreFlexRWTermVectorsFormat.cs | 3 +- .../ThreadedIndexingAndSearchingTestCase.cs | 23 ++-- .../Search/ShardSearchingTestBase.cs | 2 +- .../Store/MockDirectoryWrapper.cs | 8 +- .../Store/MockIndexOutputWrapper.cs | 7 +- .../JavaCompatibility/SystemTypesHelpers.cs | 11 -- .../Support/StackTraceHelper.cs | 68 ----------- .../TestExceptionExtensions.cs | 73 ++++++++++++ .../ExceptionHandling/TestStackTraceHelper.cs | 59 ++++++++++ .../Analysis/Core/TestRandomChains.cs | 2 +- .../Analysis/Util/TestBufferedCharFilter.cs | 9 +- .../JS/TestCustomFunctions.cs | 50 ++++---- .../Taxonomy/TestTaxonomyCombined.cs | 14 ++- .../IndexAndTaxonomyReplicationClientTest.cs | 3 +- .../IndexReplicationClientTest.cs | 7 +- .../Spell/TestSpellChecker.cs | 25 +--- .../Suggest/LookupBenchmarkTest.cs | 9 +- src/Lucene.Net.Tests/Index/TestAddIndexes.cs | 6 +- .../Index/TestAtomicUpdate.cs | 2 +- .../Index/TestBackwardsCompatibility.cs | 2 +- .../Index/TestBackwardsCompatibility3x.cs | 2 +- .../Index/TestConcurrentMergeScheduler.cs | 3 +- .../Index/TestCrashCausesCorruptIndex.cs | 3 +- .../Index/TestDirectoryReaderReopen.cs | 2 +- .../Index/TestDocumentsWriterStallControl.cs | 10 +- .../Index/TestFlushByRamOrCountsPolicy.cs | 2 +- src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 18 +-- .../Index/TestIndexWriterDelete.cs | 23 ++-- .../Index/TestIndexWriterExceptions.cs | 30 ++--- .../Index/TestIndexWriterMerging.cs | 2 +- .../Index/TestIndexWriterNRTIsCurrent.cs | 8 +- .../Index/TestIndexWriterOnDiskFull.cs | 16 +-- .../Index/TestIndexWriterOnJRECrash.cs | 2 +- .../TestIndexWriterOutOfFileDescriptors.cs | 3 +- .../Index/TestIndexWriterReader.cs | 5 +- .../Index/TestIndexWriterWithThreads.cs | 14 +-- .../Index/TestNRTReaderWithThreads.cs | 2 +- src/Lucene.Net.Tests/Index/TestPayloads.cs | 2 +- .../Index/TestSnapshotDeletionPolicy.cs | 2 +- .../Index/TestStressIndexing.cs | 2 +- .../Index/TestStressIndexing2.cs | 3 +- src/Lucene.Net.Tests/Index/TestStressNRT.cs | 4 +- .../Index/TestThreadedForceMerge.cs | 2 +- .../Index/TestTransactions.cs | 2 +- .../TestControlledRealTimeReopenThread.cs | 2 +- .../Search/TestMultiThreadTermVectors.cs | 5 +- .../Search/TestSearcherManager.cs | 7 +- .../Search/TestShardSearching.cs | 2 +- .../Search/TestTimeLimitingCollector.cs | 2 +- src/Lucene.Net.Tests/Store/TestLockFactory.cs | 30 ++--- .../Support/Text/TestStringExtensions.cs | 48 ++++++++ .../Support/Threading/JSR166TestCase.cs | 2 +- .../Util/Packed/TestPackedInts.cs | 2 +- src/Lucene.Net.Tests/Util/TestArrayUtil.cs | 3 +- src/Lucene.Net/Index/CheckIndex.cs | 80 ++++++------- src/Lucene.Net/Index/IndexFileDeleter.cs | 4 +- src/Lucene.Net/Search/FieldCacheImpl.cs | 8 +- .../ExceptionHandling/ExceptionExtensions.cs | 64 ++++++++++ .../ExceptionHandling/StackTraceHelper.cs | 111 ++++++++++++++++++ .../Support/Text/StringExtensions.cs | 21 ++++ .../Support/Util/ExceptionExtensions.cs | 12 +- 70 files changed, 645 insertions(+), 352 deletions(-) delete mode 100644 src/Lucene.Net.TestFramework/Support/StackTraceHelper.cs create mode 100644 src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestStackTraceHelper.cs create mode 100644 src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs create mode 100644 src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs diff --git a/Directory.Build.targets b/Directory.Build.targets index 1dc7daa031..60014e02b9 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -80,7 +80,7 @@ portable - + $(DefineConstants);FEATURE_ARRAY_FILL @@ -93,6 +93,13 @@ + + + + $(DefineConstants);FEATURE_STRING_CONTAINS_STRINGCOMPARISON + + + diff --git a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs index 46223a2ade..dae4477cf4 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs @@ -58,8 +58,7 @@ public Benchmark(TextReader algReader) } catch (Exception e) when (e.IsException()) { - //e.printStackTrace(); - Console.Error.WriteLine(e.ToString()); + e.PrintStackTrace(); throw new Exception("Error: cannot init PerfRunData!", e); } @@ -145,7 +144,7 @@ public static void Exec(string[] args) } catch (Exception e) when (e.IsException()) { - Console.Error.WriteLine(e.ToString()); + e.PrintStackTrace(); Environment.Exit(1); } @@ -160,7 +159,7 @@ public static void Exec(string[] args) catch (Exception e) when (e.IsException()) { Console.Error.WriteLine("Error: cannot execute the algorithm! " + e.Message); - Console.Error.WriteLine(e.ToString()); + e.PrintStackTrace(); } Console.WriteLine("####################"); diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs index 08df36a10e..fa709819b9 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs @@ -123,7 +123,7 @@ private static Query[] CreateQueries(IList qs, Analyzer a) } catch (Exception e) when (e.IsException()) { - Console.Error.WriteLine(e.ToString()); + e.PrintStackTrace(); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs index 12b80cde78..e6c7df4605 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs @@ -103,7 +103,7 @@ private static Query[] CreateQueries(IList qs, Analyzer a) } catch (Exception e) when (e.IsException()) { - Console.Error.WriteLine(e.ToString()); + e.PrintStackTrace(); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs index 6cb69b5130..4db0cd4fce 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs @@ -38,7 +38,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds /// /// work.dirspecifies the working directory. Required if "docs.dir" /// denotes a relative path (default=work). - /// docs.dirspecifies the directory where the TREC files reside. + /// docs.dirspecifies the directory where the TREC files reside. /// Can be set to a relative path if "work.dir" is also specified /// (default=trec). /// @@ -161,7 +161,7 @@ private void Read(StringBuilder buf, string lineStart, internal virtual void OpenNextFile() { DoClose(); - //currPathType = null; + //currPathType = null; while (true) { if (nextFile >= inputFiles.Count) @@ -181,7 +181,7 @@ internal virtual void OpenNextFile() } try { - Stream inputStream = StreamUtils.GetInputStream(f); // support either gzip, bzip2, or regular text file, by extension + Stream inputStream = StreamUtils.GetInputStream(f); // support either gzip, bzip2, or regular text file, by extension reader = new StreamReader(inputStream, m_encoding); currPathType = TrecDocParser.PathType(f); return; @@ -234,7 +234,7 @@ private void DoClose() // LUCENENET specific - separate disposing from closing s if (m_verbose) { Console.WriteLine("failed to dispose reader !"); - Console.WriteLine(e.ToString()); + e.PrintStackTrace(Console.Out); } } reader = null; @@ -275,7 +275,7 @@ public override DocData GetNextDocData(DocData docData) docBuf.Length = 0; Read(docBuf, DOC, false, false); - // save parsedFile for passing trecDataParser after the sync block, in + // save parsedFile for passing trecDataParser after the sync block, in // case another thread will open another file in between. parsedPathType = currPathType; @@ -302,7 +302,7 @@ public override DocData GetNextDocData(DocData docData) // count char length of text to be parsed (may be larger than the resulted plain doc body text). AddBytes(docBuf.Length); - // This code segment relies on HtmlParser being thread safe. When we get + // This code segment relies on HtmlParser being thread safe. When we get // here, everything else is already private to that thread, so we're safe. docData = trecDocParser.Parse(docData, name, this, docBuf, parsedPathType); AddItem(); @@ -367,7 +367,7 @@ public override void SetConfig(Config config) { m_encoding = Encoding.GetEncoding("iso-8859-1"); //StandardCharsets.ISO_8859_1.name(); } - // iteration exclusion in doc name + // iteration exclusion in doc name excludeDocnameIteration = config.Get("content.source.excludeIteration", false); } } diff --git a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs index 514bfdcf59..bfd6dc7343 100644 --- a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs +++ b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs @@ -144,8 +144,7 @@ public static void Main(string[] args) } catch (Exception ioe) when (ioe.IsIOException()) { - Console.Error.WriteLine(ioe.ToString()); - //Console.Write(ioe.StackTrace); + ioe.PrintStackTrace(); } finally { @@ -162,8 +161,7 @@ public static void Main(string[] args) } catch (Exception ioe) when (ioe.IsIOException()) { - Console.Error.WriteLine(ioe.ToString()); - //Console.Write(ioe.StackTrace); + ioe.PrintStackTrace(); } } } diff --git a/src/Lucene.Net.Replicator/ReplicationClient.cs b/src/Lucene.Net.Replicator/ReplicationClient.cs index ae735c576a..ad8fe91ef6 100644 --- a/src/Lucene.Net.Replicator/ReplicationClient.cs +++ b/src/Lucene.Net.Replicator/ReplicationClient.cs @@ -291,7 +291,8 @@ private void WriteToInfoStream(string message) /// protected virtual void HandleUpdateException(Exception exception) { - WriteToInfoStream(string.Format("an error occurred during revision update: {0}", exception)); + // LUCENENET specific - use utility method, and print full exception to be equivalent to printStackTrace in Java + WriteToInfoStream($"an error occurred during revision update: {exception}"); } /// diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs index 6ea882ec7a..67a4c892eb 100644 --- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs +++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs @@ -5,7 +5,6 @@ using Lucene.Net.Documents; using Lucene.Net.Index; using Lucene.Net.Support; -using Lucene.Net.Support.Threading; using Lucene.Net.Util; using RandomizedTesting.Generators; using System; @@ -545,7 +544,7 @@ internal static void CheckResetException(Analyzer a, string input) } catch (Exception unexpected) when (unexpected.IsException()) { - unexpected.printStackTrace(Console.Error); + unexpected.PrintStackTrace(Console.Error); Assert.Fail("Got wrong exception when Reset() not called: " + unexpected); } finally diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs index c64495ab78..c76ab663bd 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs @@ -1,4 +1,5 @@ using Lucene.Net.Index; +using Lucene.Net.Support; using Lucene.Net.Util; using Console = Lucene.Net.Util.SystemConsole; @@ -81,4 +82,4 @@ protected override bool SortTermsByUnicode } } #pragma warning restore 612, 618 -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsFormat.cs index 920907988a..a7b726a4fc 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsFormat.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWTermVectorsFormat.cs @@ -1,5 +1,6 @@ using Lucene.Net.Index; using Lucene.Net.Store; +using Lucene.Net.Support; using Lucene.Net.Util; using System; @@ -65,4 +66,4 @@ protected internal override bool SortTermsByUnicode() } } #pragma warning restore 612, 618 -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs index 29744b0706..8ada053450 100644 --- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs @@ -121,10 +121,10 @@ protected virtual void DoAfterIndexingThreadDone() { } - private ThreadJob[] LaunchIndexingThreads(LineFileDocs docs, - int numThreads, - long stopTime, - ISet delIDs, + private ThreadJob[] LaunchIndexingThreads(LineFileDocs docs, + int numThreads, + long stopTime, + ISet delIDs, ISet delPackIDs, ConcurrentQueue allSubDocs) { @@ -264,7 +264,7 @@ public override void Run() outerInstance.m_delCount.AddAndGet(delSubDocs.SubIDs.Count); if (Verbose) { - Console.WriteLine(Thread.CurrentThread.Name + ": update pack packID=" + delSubDocs.PackID + + Console.WriteLine(Thread.CurrentThread.Name + ": update pack packID=" + delSubDocs.PackID + " count=" + docsList.Count + " docs=" + string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", docIDs)); } outerInstance.UpdateDocuments(packIDTerm, docsList); @@ -273,7 +273,7 @@ public override void Run() { if (Verbose) { - Console.WriteLine(Thread.CurrentThread.Name + ": add pack packID=" + packID + + Console.WriteLine(Thread.CurrentThread.Name + ": add pack packID=" + packID + " count=" + docsList.Count + " docs=" + string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", docIDs)); } outerInstance.AddDocuments(packIDTerm, docsList); @@ -378,9 +378,8 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": hit exc"); - Console.WriteLine(t.ToString()); - Console.Write(t.StackTrace); - outerInstance.m_failed.Value = (true); + outerInstance.m_failed.Value = true; + t.PrintStackTrace(); throw RuntimeException.Create(t); } } @@ -536,8 +535,8 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": hit exc"); - outerInstance.m_failed.Value = (true); - Console.WriteLine(t.ToString()); + outerInstance.m_failed.Value = true; + t.PrintStackTrace(Console.Out); throw RuntimeException.Create(t); } } @@ -929,4 +928,4 @@ protected virtual void SmokeTestSearcher(IndexSearcher s) RunQuery(s, pq); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs index a549dda5a5..48057d5085 100644 --- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs +++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs @@ -736,7 +736,7 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine("FAILED:"); - Console.Out.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); throw RuntimeException.Create(t); } } diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs index 46841b47ee..5986ea40e4 100644 --- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs @@ -494,6 +494,7 @@ internal virtual void MaybeThrowIOException(string message) if (LuceneTestCase.Verbose) { Console.WriteLine(Thread.CurrentThread.Name + ": MockDirectoryWrapper: now throw random exception" + (message is null ? "" : " (" + message + ")")); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new IOException("a random IOException" + (message is null ? "" : " (" + message + ")")); } @@ -505,7 +506,8 @@ internal virtual void MaybeThrowIOExceptionOnOpen(string name) { if (LuceneTestCase.Verbose) { - Console.WriteLine(Thread.CurrentThread.Name + ": MockDirectoryWrapper: now throw random exception during open file=" + name); + Console.WriteLine(Thread.CurrentThread.Name + ": MockDirectoryWrapper: now throw random exception during open file=" + name); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } if (allowRandomFileNotFoundException == false || randomState.NextBoolean()) { @@ -513,7 +515,7 @@ internal virtual void MaybeThrowIOExceptionOnOpen(string name) } else { - throw randomState.NextBoolean() ? (IOException)new FileNotFoundException("a random IOException (" + name + ")") : new DirectoryNotFoundException("a random IOException (" + name + ")"); + throw randomState.NextBoolean() ? new FileNotFoundException("a random IOException (" + name + ")") : new DirectoryNotFoundException("a random IOException (" + name + ")"); } } } @@ -1038,7 +1040,7 @@ protected override void Dispose(bool disposing) catch (Exception t) when (t.IsThrowable()) { Console.Error.WriteLine("ERROR processing leftover segments file " + file + ":"); - Console.WriteLine(t.ToString()); + t.PrintStackTrace(); } } } diff --git a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs index db72c1da0d..e55765efc1 100644 --- a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs @@ -1,4 +1,5 @@ -using Lucene.Net.Util; +using Lucene.Net.Support; +using Lucene.Net.Util; using System; using System.IO; using System.Threading; @@ -97,7 +98,7 @@ private void CheckDiskFull(byte[] b, int offset, DataInput @in, long len) if (LuceneTestCase.Verbose) { Console.WriteLine(Thread.CurrentThread.Name + ": MDW: now throw fake disk full"); - Console.WriteLine(Environment.StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new IOException(message); } @@ -199,4 +200,4 @@ public override string ToString() return "MockIndexOutputWrapper(" + @delegate + ")"; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs b/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs index 68733500de..6f149416d5 100644 --- a/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs +++ b/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net @@ -290,16 +289,6 @@ public static void retainAll(this ISet s, ISet other) } } - public static void printStackTrace(this Exception e) - { - Console.Error.WriteLine(e.StackTrace); - } - - public static void printStackTrace(this Exception e, TextWriter destination) - { - destination.WriteLine(e.StackTrace); - } - /// /// Locates resources in the same directory as this type /// diff --git a/src/Lucene.Net.TestFramework/Support/StackTraceHelper.cs b/src/Lucene.Net.TestFramework/Support/StackTraceHelper.cs deleted file mode 100644 index 773f26e299..0000000000 --- a/src/Lucene.Net.TestFramework/Support/StackTraceHelper.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Diagnostics; - -namespace Lucene.Net.Util -{ - /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /// - /// LUCENENET specific class to normalize stack trace behavior between different .NET Framework and .NET Standard 1.x, - /// which did not support the StackTrace class. - /// - public static class StackTraceHelper - { - /// - /// Matches the StackTrace for a method name. - /// - /// IMPORTANT: To make the tests pass in release mode, the method(s) named here - /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)]. - /// - public static bool DoesStackTraceContainMethod(string methodName) - { - StackTrace trace = new StackTrace(); - foreach (var frame in trace.GetFrames()) - { - if (frame.GetMethod().Name.Equals(methodName, StringComparison.Ordinal)) - { - return true; - } - } - return false; - } - - /// - /// Matches the StackTrace for a particular class (not fully-qualified) and method name. - /// - /// IMPORTANT: To make the tests pass in release mode, the method(s) named here - /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)]. - /// - public static bool DoesStackTraceContainMethod(string className, string methodName) - { - StackTrace trace = new StackTrace(); - foreach (var frame in trace.GetFrames()) - { - var method = frame.GetMethod(); - if (method.DeclaringType.Name.Equals(className, StringComparison.Ordinal) && method.Name.Equals(methodName, StringComparison.Ordinal)) - { - return true; - } - } - return false; - } - } -} diff --git a/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestExceptionExtensions.cs b/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestExceptionExtensions.cs index 9efc1c5b2f..862db3661a 100644 --- a/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestExceptionExtensions.cs +++ b/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestExceptionExtensions.cs @@ -1,10 +1,16 @@ using Lucene.Net.Attributes; +using Lucene.Net.Util; using NUnit.Framework; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Assert = Lucene.Net.TestFramework.Assert; +#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON +using Lucene.Net.Support.Text; +#endif + namespace Lucene.Net.Support.ExceptionHandling { /* @@ -375,6 +381,73 @@ public void TestIsIllegalArgumentException_TestEnvironment(Type exceptionType, b } } + private class MyException : Exception + { + public MyException(string message) : base(message) + { + } + } + + private class MyException2 : Exception + { + public MyException2(string message) : base(message) + { + } + } + + [Test] + public void TestPrintStackTrace() + { + using var sw = new StringWriter(); + + try + { + throw new MyException("Test exception"); + } + catch (Exception e) + { + e.PrintStackTrace(sw); + } + + var str = sw.ToString(); + + Assert.IsTrue(str.Contains(typeof(MyException).FullName!, StringComparison.Ordinal)); + Assert.IsTrue(str.Contains("Test exception", StringComparison.Ordinal)); + Assert.IsTrue(str.Contains(nameof(TestPrintStackTrace), StringComparison.Ordinal)); + } + + [Test] + public void TestPrintStackTrace_WithSuppressed() + { + using var sw = new StringWriter(); + + try + { + throw new MyException("Test exception"); + } + catch (Exception e) + { + try + { + throw new MyException2("Suppressed exception"); + } + catch (Exception suppressed) + { + e.AddSuppressed(suppressed); + } + + e.PrintStackTrace(sw); + } + + var str = sw.ToString(); + + Assert.IsTrue(str.Contains(typeof(MyException).FullName!, StringComparison.Ordinal)); + Assert.IsTrue(str.Contains("Test exception", StringComparison.Ordinal)); + Assert.IsTrue(str.Contains(nameof(TestPrintStackTrace), StringComparison.Ordinal)); + Assert.IsTrue(str.Contains(typeof(MyException2).FullName!, StringComparison.Ordinal)); + Assert.IsTrue(str.Contains("Suppressed exception", StringComparison.Ordinal)); + } + private static void AssertCatches(Action action, Func extensionMethodExpression) { try diff --git a/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestStackTraceHelper.cs b/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestStackTraceHelper.cs new file mode 100644 index 0000000000..13085e68dc --- /dev/null +++ b/src/Lucene.Net.Tests.AllProjects/Support/ExceptionHandling/TestStackTraceHelper.cs @@ -0,0 +1,59 @@ +using Lucene.Net.Attributes; +using Lucene.Net.Util; +using NUnit.Framework; +using System.IO; + +namespace Lucene.Net.Support.ExceptionHandling +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + [TestFixture, LuceneNetSpecific] + public class TestStackTraceHelper : LuceneTestCase + { + [Test] + [TestCase(true, nameof(TestDoesStackTraceContainMethod))] + [TestCase(false, nameof(GetHashCode))] + public void TestDoesStackTraceContainMethod(bool expected, string methodName) + { + Assert.AreEqual(expected, StackTraceHelper.DoesStackTraceContainMethod(methodName)); + } + + [Test] + [TestCase(true, nameof(TestStackTraceHelper), nameof(TestDoesStackTraceContainMethodWithClassName))] + [TestCase(false, nameof(TestStackTraceHelper), nameof(GetHashCode))] + [TestCase(false, nameof(LuceneTestCase), nameof(TestDoesStackTraceContainMethodWithClassName))] + public void TestDoesStackTraceContainMethodWithClassName(bool expected, string className, string methodName) + { + Assert.AreEqual(expected, StackTraceHelper.DoesStackTraceContainMethod(className, methodName)); + } + + [Test] + public void TestPrintCurrentStackTrace() + { + using var sw = new StringWriter(); + StackTraceHelper.PrintCurrentStackTrace(sw); + + string str = sw.ToString(); + + using var sr = new StringReader(str); + string topLine = sr.ReadLine(); + Assert.NotNull(topLine); + Assert.IsTrue(topLine.Contains(nameof(TestPrintCurrentStackTrace))); + } + } +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs index 60c2866988..41720d2065 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs @@ -933,7 +933,7 @@ private T CreateComponent(ConstructorInfo ctor, object[] args, StringBuilder if (Verbose) { Console.WriteLine("Ignoring IAE/UOE from ctor:"); - //cause.printStackTrace(System.err); + ite.InnerException.PrintStackTrace(Console.Error); } } else diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs index ce6e3941e2..739781047e 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs @@ -429,7 +429,7 @@ public void Test_ReadCII() //char[] contents = new char[size]; - //public int read() + //public int read() //{ // if (pos >= size) // throw new IOException("Read past end of data"); @@ -453,7 +453,7 @@ public void Test_ReadCII() // return size - pos > 0; //} - //public void close() + //public void close() //{ //} // }); @@ -713,6 +713,8 @@ public void Test_ReadLine() /** * @tests java.io.BufferedReader#ready() */ + [Test, LuceneNetSpecific] + [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/1102")] // LUCENENET TODO: fix test public void Test_Ready() { // Test for method boolean java.io.BufferedReader.ready() @@ -730,6 +732,7 @@ public void Test_Ready() /** * @tests java.io.BufferedReader#reset() */ + [Test, LuceneNetSpecific] public void Test_Reset() { // Test for method void java.io.BufferedReader.reset() @@ -850,4 +853,4 @@ public override void TearDown() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs index 00b84947ab..3ab9e7e751 100644 --- a/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs +++ b/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs @@ -63,19 +63,19 @@ public virtual void TestDefaultList() public virtual void TestNoArgMethod() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("ZeroArgMethod"); + functions["foo"] = GetType().GetMethod(nameof(ZeroArgMethod)); var expr = JavascriptCompiler.Compile("foo()", functions); Assert.AreEqual(5, expr.Evaluate(0, null), DELTA); } - public static double OneArgMethod(double arg1) => 3 + arg1; + public static double OneArgMethod(double arg1) => 3 + arg1; /// tests a method with one arguments [Test] public virtual void TestOneArgMethod() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("OneArgMethod", new []{ typeof(double)}); + functions["foo"] = GetType().GetMethod(nameof(OneArgMethod), new []{ typeof(double)}); var expr = JavascriptCompiler.Compile("foo(3)", functions); Assert.AreEqual(6, expr.Evaluate(0, null), DELTA); } @@ -87,7 +87,7 @@ public virtual void TestOneArgMethod() public virtual void TestThreeArgMethod() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("ThreeArgMethod", new []{ typeof(double), typeof(double), typeof(double)}); + functions["foo"] = GetType().GetMethod(nameof(ThreeArgMethod), new []{ typeof(double), typeof(double), typeof(double)}); var expr = JavascriptCompiler.Compile("foo(3, 4, 5)", functions); Assert.AreEqual(12, expr.Evaluate(0, null), DELTA); } @@ -97,20 +97,20 @@ public virtual void TestThreeArgMethod() public virtual void TestTwoMethods() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("ZeroArgMethod"); - functions["bar"] = GetType().GetMethod("OneArgMethod", new []{typeof(double)}); + functions["foo"] = GetType().GetMethod(nameof(ZeroArgMethod)); + functions["bar"] = GetType().GetMethod(nameof(OneArgMethod), new[] { typeof(double) }); var expr = JavascriptCompiler.Compile("foo() + bar(3)", functions); Assert.AreEqual(11, expr.Evaluate(0, null), DELTA); } - public static string BogusReturnType() => "bogus!"; + public static string BogusReturnType() => "bogus!"; /// wrong return type: must be double [Test] public virtual void TestWrongReturnType() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("BogusReturnType"); + functions["foo"] = GetType().GetMethod(nameof(BogusReturnType)); try { JavascriptCompiler.Compile("foo()", functions); @@ -122,14 +122,14 @@ public virtual void TestWrongReturnType() } } - public static double BogusParameterType(string s) => 0; + public static double BogusParameterType(string s) => 0; /// wrong param type: must be doubles [Test] public virtual void TestWrongParameterType() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("BogusParameterType", new []{ typeof(string)}); + functions["foo"] = GetType().GetMethod(nameof(BogusParameterType), new[] { typeof(string) }); try { JavascriptCompiler.Compile("foo(2)", functions); @@ -141,14 +141,14 @@ public virtual void TestWrongParameterType() } } - public virtual double NonStaticMethod() => 0; + public virtual double NonStaticMethod() => 0; /// wrong modifiers: must be static [Test] public virtual void TestWrongNotStatic() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("NonStaticMethod"); + functions["foo"] = GetType().GetMethod(nameof(NonStaticMethod)); try { JavascriptCompiler.Compile("foo()", functions); @@ -167,8 +167,8 @@ public virtual void TestWrongNotStatic() public virtual void TestWrongNotPublic() { IDictionary functions = new Dictionary(); - functions["foo"] = GetType().GetMethod("NonPublicMethod",BindingFlags.NonPublic|BindingFlags.Static); - + functions["foo"] = GetType().GetMethod(nameof(NonPublicMethod), BindingFlags.NonPublic | BindingFlags.Static); + try { JavascriptCompiler.Compile("foo()", functions); @@ -190,7 +190,7 @@ internal class NestedNotPublic public virtual void TestWrongNestedNotPublic() { IDictionary functions = new Dictionary(); - functions["foo"] = typeof(NestedNotPublic).GetMethod("Method"); + functions["foo"] = typeof(NestedNotPublic).GetMethod(nameof(NestedNotPublic.Method)); try { JavascriptCompiler.Compile("foo()", functions); @@ -204,8 +204,8 @@ public virtual void TestWrongNestedNotPublic() //LUCENENET: testClassLoader() was not ported. (May not apply to Lucene.Net) - - + + internal static string MESSAGE = "This should not happen but it happens"; public static class StaticThrowingException // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable @@ -223,8 +223,8 @@ public static double Method() public virtual void TestThrowingException() { IDictionary functions = new Dictionary(); - functions["foo"] = typeof(StaticThrowingException).GetMethod("Method"); - string source = "3 * foo() / 5"; + functions["foo"] = typeof(StaticThrowingException).GetMethod(nameof(StaticThrowingException.Method)); + const string source = "3 * foo() / 5"; var expr = JavascriptCompiler.Compile(source, functions); try { @@ -234,14 +234,16 @@ public virtual void TestThrowingException() catch (Exception e) when (e.IsArithmeticException()) { Assert.AreEqual(MESSAGE, e.Message); - StringWriter sw = new StringWriter(); - e.printStackTrace(); + using StringWriter sw = new StringWriter(); + e.PrintStackTrace(sw); + sw.Flush(); //.NET Port + var swString = sw.ToString(); Assert.IsTrue( // LUCENENET: Apparently in .NET 7, they finally fixed this weird display issue with spaces before the comma // and closing parenthesis. It is a pass. - e.StackTrace.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32, FunctionValues[])") || - e.StackTrace.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32 , FunctionValues[] )") + swString.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32, FunctionValues[])") || + swString.Contains("Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32 , FunctionValues[] )") ); } } @@ -252,7 +254,7 @@ public virtual void TestNamespaces() { IDictionary functions = new Dictionary(); functions["foo.bar"] = GetType().GetMethod("ZeroArgMethod"); - string source = "foo.bar()"; + const string source = "foo.bar()"; var expr = JavascriptCompiler.Compile(source, functions); Assert.AreEqual(5, expr.Evaluate(0, null), DELTA); } diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs index 2d1ac3580e..9de607eb1b 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyCombined.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using System; using System.Globalization; +using System.IO; using System.Text; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; @@ -860,7 +861,7 @@ private void AssertConsistentYoungestChild(FacetLabel abPath, int abOrd, int abY stop.Value = true; thread.Join(); - Assert.IsNull(error[0], "Unexpcted exception at retry " + retry + " retrieval " + retrieval[0] + ": \n" + stackTraceStr(error[0])); + Assert.IsNull(error[0], "Unexpcted exception at retry " + retry + " retrieval " + retrieval[0] + ": \n" + StackTraceStr(error[0])); tr.Dispose(); } @@ -926,15 +927,20 @@ private void AssertChildrenArrays(ParallelTaxonomyArrays ca, int retry, int retr /// Grab the stack trace into a string since the exception was thrown in a thread and we want the assert /// outside the thread to show the stack trace in case of failure. /// - private string stackTraceStr(Exception error) + // LUCENENET specific - made static + private static string StackTraceStr(Exception error) { if (error is null) { return ""; } - error.printStackTrace(); - return error.StackTrace; + // LUCENENET specific - we can just return e.ToString() here to get the Java equivalent with less allocations. would otherwise be: + // using var sw = new StringWriter(); + // error.PrintStackTrace(sw); + // sw.Flush(); + // return sw.ToString(); + return error.ToString(); } /// diff --git a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs index bfc219bea0..a57115f84c 100644 --- a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs +++ b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs @@ -445,7 +445,8 @@ protected override void HandleUpdateException(Exception exception) { if (Verbose) { - Console.WriteLine("hit exception during update: " + exception); + Console.WriteLine("hit exception during update: " + exception.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior + exception.PrintStackTrace(Console.Out); } // test that the index can be read and also some basic statistics diff --git a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs index 01085c8636..8ff27fb5b3 100644 --- a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs +++ b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs @@ -273,7 +273,7 @@ public void TestConsistencyOnExceptions() } // disable errors -- maybe randomness didn't exhaust all allowed failures, - // and we don't want e.g. CheckIndex to hit false errors. + // and we don't want e.g. CheckIndex to hit false errors. handlerDir.MaxSizeInBytes = 0; handlerDir.RandomIOExceptionRate = 0.0; handlerDir.RandomIOExceptionRateOnOpen = 0.0; @@ -352,7 +352,8 @@ protected override void HandleUpdateException(Exception exception) { if (Verbose) { - Console.WriteLine("hit exception during update: " + exception); + Console.WriteLine("hit exception during update: " + exception.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior + exception.PrintStackTrace(Console.Out); } try @@ -406,4 +407,4 @@ protected override void HandleUpdateException(Exception exception) } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs index b26d87f03d..f1ca96460e 100644 --- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs +++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs @@ -448,7 +448,7 @@ public void TestClose() } /* - * tests if the internally shared indexsearcher is correctly closed + * tests if the internally shared indexsearcher is correctly closed * when the spellchecker is concurrently accessed and closed. */ [Test] @@ -490,7 +490,7 @@ public async Task TestConcurrentAccess() Thread.Sleep(100); // concurrently reset the spell index spellChecker.SetSpellIndex(this.spellindex); - // for debug - prints the internal open searchers + // for debug - prints the internal open searchers // showSearchersOpen(); } @@ -559,7 +559,7 @@ private void AssertSearchersClosed() // for (IndexSearcher searcher : searchers) { // if(searcher.getIndexReader().getRefCount() > 0) // ++count; - // } + // } // System.out.println(count); // } @@ -578,7 +578,7 @@ public SpellCheckWorker(TestSpellChecker outerInstance, IndexReader reader, Atom { this.outerInstance = outerInstance; this.reader = reader; - + this.stop = stop; this.cancellationToken = cancellationToken; this.taskNum = taskNum; @@ -611,7 +611,7 @@ public void Run() } catch (Exception e) when (e.IsThrowable()) { - e.printStackTrace(); + e.PrintStackTrace(); error = e; return; } @@ -630,21 +630,6 @@ public void Run() } } - /// - /// Grab the stack trace into a string since the exception was thrown in a thread and we want the assert - /// outside the thread to show the stack trace in case of failure. - /// - private string stackTraceStr(Exception error) - { - if (error is null) - { - return ""; - } - - error.printStackTrace(); - return error.StackTrace; - } - internal class SpellCheckerMock : SpellChecker { public SpellCheckerMock(Directory spellIndex) diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs index e4669f5e7e..07eba88c7d 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs @@ -165,7 +165,7 @@ public void TestStorageNeeds() } /** - * Create instance and populate it. + * Create instance and populate it. */ internal Lookup BuildLookup(Type cls, Input[] input) { @@ -227,7 +227,7 @@ public void TestPerformanceOnPrefixes2_4() } /** - * Run the actual benchmark. + * Run the actual benchmark. */ public void RunPerformanceTest(int minPrefixLen, int maxPrefixLen, int num, bool onlyMorePopular) @@ -290,7 +290,7 @@ public int Call() */ private BenchmarkResult Measure(Func callable) { - double NANOS_PER_MS = 1000000; + const double NANOS_PER_MS = 1000000; try { @@ -305,9 +305,8 @@ private BenchmarkResult Measure(Func callable) } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(); throw RuntimeException.Create(e); - } } diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs index fe49a296de..b07ceeb147 100644 --- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs +++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs @@ -831,7 +831,7 @@ public CommitAndAddIndexes(int numCopy) internal override void Handle(Exception t) { - t.printStackTrace(Console.Out); + t.PrintStackTrace(Console.Out); UninterruptableMonitor.Enter(failures); try { @@ -936,7 +936,7 @@ internal override void Handle(Exception t) { if (!t.IsAlreadyClosedException() && !t.IsNullPointerException()) { - t.printStackTrace(Console.Out); + t.PrintStackTrace(Console.Out); UninterruptableMonitor.Enter(failures); try { @@ -1046,7 +1046,7 @@ internal override void Handle(Exception t) } if (report) { - t.printStackTrace(Console.Out); + t.PrintStackTrace(Console.Out); UninterruptableMonitor.Enter(failures); try { diff --git a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs index 48410fe188..bdd356a02e 100644 --- a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs +++ b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs @@ -68,7 +68,7 @@ public override void Run() catch (Exception e) when (e.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": exc"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); failed = true; } } diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs index 4989ce80ea..91bf151c48 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs @@ -300,7 +300,7 @@ public virtual void TestUnsupportedOldIndexes() if (Verbose) { Console.WriteLine("TEST: got expected exc:"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); } // Make sure exc message includes a path= Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message); diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs index 336580ff9e..77239b5546 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs @@ -231,7 +231,7 @@ public virtual void TestUnsupportedOldIndexes() if (Verbose) { Console.WriteLine("TEST: got expected exc:"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); } // Make sure exc message includes a path= Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message); diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs index 9d3ded4b86..b74750cc00 100644 --- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs +++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs @@ -3,7 +3,6 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using Lucene.Net.Store; -using Lucene.Net.Support.Threading; using Lucene.Net.Util; using NUnit.Framework; using RandomizedTesting.Generators; @@ -129,7 +128,7 @@ public virtual void TestFlushExceptions() { if (Verbose) { - Console.WriteLine(ioe.StackTrace); + ioe.PrintStackTrace(Console.Out); } failure.ClearDoFail(); break; diff --git a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs index dbd97f2a9d..15ad99a3f6 100644 --- a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs +++ b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs @@ -1,4 +1,5 @@ using Lucene.Net.Documents; +using Lucene.Net.Util; using NUnit.Framework; using System; using System.IO; @@ -190,7 +191,7 @@ public override IndexOutput CreateOutput(string name, IOContext cxt) if (Verbose) { Console.WriteLine("TEST: now crash"); - Console.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new CrashingException("crashAfterCreateOutput " + crashAfterCreateOutput); } diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs index fbc97cfde9..daeb3926c0 100644 --- a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs +++ b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs @@ -506,7 +506,7 @@ public override void Run() } catch (Exception r) when (r.IsThrowable()) { - Console.WriteLine(r.StackTrace); + r.PrintStackTrace(Console.Out); this.error = r; } } diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs index e59ac79119..f059dff520 100644 --- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs +++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs @@ -1,6 +1,5 @@ using J2N.Threading; using J2N.Threading.Atomic; -using Lucene.Net.Support.Threading; using NUnit.Framework; using RandomizedTesting.Generators; using System; @@ -160,8 +159,7 @@ public virtual void TestAccquireReleaseRace() { foreach (Exception throwable in exceptions) { - Console.WriteLine(throwable.ToString()); - Console.Write(throwable.StackTrace); + throwable.PrintStackTrace(); } Assert.Fail("got exceptions in threads"); } @@ -283,8 +281,7 @@ public override void Run() } catch (Exception e) when (e.IsThrowable()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); exceptions.Add(e); } } @@ -351,8 +348,7 @@ public override void Run() } catch (Exception e) when (e.IsThrowable()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); exceptions.Add(e); } diff --git a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs index ae61c4a7ec..731486f464 100644 --- a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs @@ -379,7 +379,7 @@ public override void Run() catch (Exception ex) when (ex.IsThrowable()) { Console.WriteLine("FAILED exc:"); - ex.printStackTrace(Console.Out); + ex.PrintStackTrace(Console.Out); throw RuntimeException.Create(ex); } } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs index bda15ce0fe..e48c12ae2e 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs @@ -1329,7 +1329,7 @@ public override void Run() // Jenkins hits a fail we need to study where the // interrupts struck! Console.WriteLine("TEST: got interrupt"); - Console.WriteLine(GetToStringFrom(re)); + Console.WriteLine(LockSafeGetToStringFrom(re)); Exception e = re.InnerException; Assert.IsTrue(e is System.Threading.ThreadInterruptedException); @@ -1356,7 +1356,7 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine("FAILED; unexpected exception"); - Console.WriteLine(GetToStringFrom(t)); + Console.WriteLine(LockSafeGetToStringFrom(t)); failed = true; break; } @@ -1406,7 +1406,7 @@ public override void Run() { failed = true; Console.WriteLine("CheckIndex FAILED: unexpected exception"); - Console.WriteLine(e.ToString()); + e.PrintStackTrace(Console.Out); } try { @@ -1417,7 +1417,7 @@ public override void Run() { failed = true; Console.WriteLine("DirectoryReader.open FAILED: unexpected exception"); - Console.WriteLine(e.ToString()); + e.PrintStackTrace(Console.Out); } } try @@ -1438,12 +1438,14 @@ public override void Run() } } - // LUCENENET specific - since the lock statement can potentially throw System.Threading.ThreadInterruptedException in .NET, - // we need to be vigilant about getting stack trace info from the errors during tests and retry if we get an interrupt exception. /// /// Safely gets the ToString() of an exception while ignoring any System.Threading.ThreadInterruptedException and retrying. /// - private static string GetToStringFrom(Exception exception) + /// + /// LUCENENET specific - since the lock statement can potentially throw System.Threading.ThreadInterruptedException in .NET, + /// we need to be vigilant about getting stack trace info from the errors during tests and retry if we get an interrupt exception. + /// + private static string LockSafeGetToStringFrom(Exception exception) { // Clear interrupt state: try @@ -1460,7 +1462,7 @@ private static string GetToStringFrom(Exception exception) } catch (Exception ie) when (ie.IsInterruptedException()) { - return GetToStringFrom(exception); + return LockSafeGetToStringFrom(exception); } } } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs index 525750e988..6ef9c61802 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs @@ -5,6 +5,7 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using Lucene.Net.Store; +using Lucene.Net.Support; using Lucene.Net.Support.IO; using Lucene.Net.Util; using NUnit.Framework; @@ -722,14 +723,13 @@ private void DoTestOperationsOnDiskFull(bool updates) { if (Verbose) { - Console.WriteLine(" hit IOException: " + e); - Console.WriteLine(e.StackTrace); + Console.WriteLine(" hit IOException: " + e.ToTypeMessageString()); // LUCENENET specific: ToTypeMessageString() mimics Java behavior + e.PrintStackTrace(Console.Out); } err = e; if (1 == x) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); Assert.Fail(testName + " hit IOException after disk space was freed up"); } } @@ -771,8 +771,7 @@ private void DoTestOperationsOnDiskFull(bool updates) } catch (Exception e) when (e.IsIOException()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); Assert.Fail(testName + ":exception when creating IndexReader after disk full during close: " + e); } @@ -784,8 +783,7 @@ private void DoTestOperationsOnDiskFull(bool updates) } catch (Exception e) when (e.IsIOException()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); Assert.Fail(testName + ": exception when searching: " + e); } int result2 = hits.Length; @@ -812,8 +810,7 @@ private void DoTestOperationsOnDiskFull(bool updates) // all docs: if (result2 != START_COUNT && result2 != END_COUNT) { - Console.WriteLine(err.ToString()); - Console.Write(err.StackTrace); + err.PrintStackTrace(); Assert.Fail(testName + ": method did throw exception but hits.Length for search on term 'aaa' is " + result2 + " instead of expected " + START_COUNT + " or " + END_COUNT); } } @@ -989,7 +986,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: mock failure: now fail"); - Console.WriteLine(Environment.StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new IOException("fail after applyDeletes"); } @@ -1003,7 +1000,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: mock failure: saw applyDeletes"); - Console.WriteLine(Environment.StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } sawMaybe = true; } @@ -1048,7 +1045,7 @@ public virtual void TestErrorInDocsWriterAdd() if (Verbose) { Console.WriteLine("TEST: got expected exc:"); - Console.WriteLine(io.StackTrace); + io.PrintStackTrace(Console.Out); } break; } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs index 93d7da5d89..c62cee0e23 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs @@ -235,7 +235,7 @@ public override void Run() if (Verbose) { Console.WriteLine(Thread.CurrentThread.Name + ": EXC: "); - Console.WriteLine(re.StackTrace); + re.PrintStackTrace(Console.Out); } try { @@ -244,7 +244,7 @@ public override void Run() catch (Exception ioe) when (ioe.IsIOException()) { Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception1"); - Console.WriteLine(ioe.StackTrace); + ioe.PrintStackTrace(Console.Out); failure = ioe; break; } @@ -252,7 +252,7 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception2"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); failure = t; break; } @@ -269,7 +269,7 @@ public override void Run() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": unexpected exception3"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); failure = t; break; } @@ -304,7 +304,7 @@ public void Apply(string name) if (Verbose) { Console.WriteLine(Thread.CurrentThread.Name + ": NOW FAIL: " + name); - Console.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new TestPoint1Exception(Thread.CurrentThread.Name + ": intentionally failing at " + name); // LUCENENET TODO: Need to change this to RuntimeException once we add a custom (or flagged) exception that is created by RuntimeException.Create } @@ -345,7 +345,7 @@ public virtual void TestRandomExceptions() thread.Run(); if (thread.failure != null) { - Console.WriteLine(thread.failure.StackTrace); + thread.failure.PrintStackTrace(Console.Out); Assert.Fail("thread " + thread.Name + ": hit unexpected failure"); } @@ -362,7 +362,7 @@ public virtual void TestRandomExceptions() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine("exception during close:"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); writer.Rollback(); } @@ -421,7 +421,7 @@ public virtual void TestRandomExceptionsThreads() catch (Exception t) when (t.IsThrowable()) { Console.WriteLine("exception during close:"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); writer.Rollback(); } @@ -789,7 +789,7 @@ public virtual void TestDocumentsWriterExceptions() if (Verbose) { Console.WriteLine("TEST: hit expected exception"); - Console.WriteLine(ioe.StackTrace); + ioe.PrintStackTrace(Console.Out); } } @@ -998,7 +998,7 @@ public override void Run() try { Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: hit unexpected exception"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); } finally { @@ -1028,7 +1028,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: now throw exc:"); - Console.WriteLine(Environment.StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new IOException("now failing on purpose during sync"); } @@ -1341,7 +1341,7 @@ public virtual void TestSegmentsChecksumError() } catch (Exception e) when (e.IsIOException()) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); Assert.Fail("segmentInfos failed to retry fallback to correct segments_N file"); } reader!.Dispose(); // LUCENENET [!]: using null suppression to match Java behavior @@ -1525,7 +1525,7 @@ public virtual void TestSimulatedCrashedWriter() } catch (Exception e) when (e.IsException()) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); Assert.Fail("writer failed to open on a crashed index"); } @@ -2364,7 +2364,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: now fail; thread=" + Thread.CurrentThread.Name + " exc:"); - Console.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } shouldFail.Value = false; throw new FakeIOException(); @@ -2535,7 +2535,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: now fail; thread=" + Thread.CurrentThread.Name + " exc:"); - Console.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } throw new FakeIOException(); } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs index bddcb786ea..5068f7c9fe 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs @@ -488,7 +488,7 @@ public override void Run() } catch (Exception e) when (e.IsThrowable()) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); failure.Add(e); done = true; break; diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs index cf3269d1a7..a59c724e19 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs @@ -66,16 +66,14 @@ public virtual void TestIsCurrentWithThreads() bool failed = writerThread.failed != null; if (failed) { - Console.WriteLine(writerThread.failed.ToString()); - Console.Write(writerThread.failed.StackTrace); + writerThread.failed.PrintStackTrace(); } for (int i = 0; i < threads.Length; i++) { threads[i].Join(); if (threads[i].failed != null) { - Console.WriteLine(threads[i].failed.ToString()); - Console.Write(threads[i].failed.StackTrace); + threads[i].failed.PrintStackTrace(); failed = true; } } @@ -253,4 +251,4 @@ public override void Run() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs index b96cb71ca3..72b48b2afa 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs @@ -103,7 +103,7 @@ public virtual void TestAddDocumentOnDiskFull() if (Verbose) { Console.WriteLine("TEST: exception on addDoc"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); } hitError = true; } @@ -133,7 +133,7 @@ public virtual void TestAddDocumentOnDiskFull() if (Verbose) { Console.WriteLine("TEST: exception on close; retry w/ no disk space limit"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); } dir.MaxSizeInBytes = 0; writer.Dispose(); @@ -427,12 +427,12 @@ public virtual void TestAddIndexOnDiskFull() if (Verbose) { Console.WriteLine(" hit IOException: " + e); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); } if (1 == x) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); Assert.Fail(methodName + " hit IOException after disk space was freed up"); } } @@ -457,7 +457,7 @@ public virtual void TestAddIndexOnDiskFull() } catch (Exception e) when (e.IsIOException()) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); Assert.Fail(testName + ": exception when creating IndexReader: " + e); } int result = reader.DocFreq(searchTerm); @@ -474,7 +474,7 @@ public virtual void TestAddIndexOnDiskFull() // all docs: if (result != START_COUNT && result != END_COUNT) { - Console.WriteLine(err.StackTrace); + err.PrintStackTrace(Console.Out); Assert.Fail(testName + ": method did throw exception but docFreq('aaa') is " + result + " instead of expected " + START_COUNT + " or " + END_COUNT); } } @@ -486,7 +486,7 @@ public virtual void TestAddIndexOnDiskFull() } catch (Exception e) when (e.IsIOException()) { - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); Assert.Fail(testName + ": exception when searching: " + e); } int result2 = hits.Length; @@ -503,7 +503,7 @@ public virtual void TestAddIndexOnDiskFull() // all docs: if (result2 != result) { - Console.WriteLine(err.StackTrace); + err.PrintStackTrace(Console.Out); Assert.Fail(testName + ": method did throw exception but hits.Length for search on term 'aaa' is " + result2 + " instead of expected " + result); } } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs index b88f6e483e..3cdcd2493a 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs @@ -286,7 +286,7 @@ public override void Run() } catch (Exception e) when (e.IsIOException()) { - Console.Error.WriteLine("Couldn't pipe from the forked process: " + e.ToString()); + Console.Error.WriteLine("Couldn't pipe from the forked process: " + e.ToTypeMessageString()); // LUCENENET specific - use ToTypeMessageString to mimic Java behavior } } } diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs index 784d5435a3..b586a801fb 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs @@ -146,8 +146,7 @@ public virtual void Test() if (Verbose) { Console.WriteLine("TEST: iter=" + iter + ": exception"); - Console.WriteLine(ioe.ToString()); - Console.Write(ioe.StackTrace); + ioe.PrintStackTrace(); } if (w != null) { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs index ab7d4d11e0..7c3949dcd0 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs @@ -1,5 +1,6 @@ using Lucene.Net.Attributes; using Lucene.Net.Search; +using Lucene.Net.Support; using Lucene.Net.Util; #if FEATURE_INDEXWRITER_TESTS using J2N.Threading; @@ -529,7 +530,7 @@ internal virtual void CloseDir() internal virtual void Handle(Exception t) { - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); UninterruptableMonitor.Enter(failures); try { @@ -1384,7 +1385,7 @@ public override void Eval(MockDirectoryWrapper dir) if (Verbose) { Console.WriteLine("TEST: now fail; exc:"); - Console.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(Console.Out); } shouldFail.Value = false; throw new FakeIOException(); diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs index 3d3b9ef4fa..9f5f49ed83 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs @@ -102,10 +102,10 @@ public override void Run() if (Verbose) { Console.WriteLine("TEST: expected exc:"); - Console.WriteLine(ioe.StackTrace); + ioe.PrintStackTrace(Console.Out); } - //System.out.println(Thread.currentThread().getName() + ": hit exc"); - //ioConsole.WriteLine(e.StackTrace); + //Console.WriteLine(Thread.CurrentThread.Name + ": hit exc"); + //ioe.PrintStackTrace(Console.Out); if (ioe.Message.StartsWith("fake disk full at", StringComparison.Ordinal) || ioe.Message.Equals("now failing on purpose", StringComparison.Ordinal)) { diskFull = true; @@ -129,7 +129,7 @@ public override void Run() if (noErrors) { Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: unexpected IOException:"); - Console.WriteLine(ioe.StackTrace); + ioe.PrintStackTrace(Console.Out); error = ioe; } break; @@ -137,11 +137,11 @@ public override void Run() } catch (Exception t) when (t.IsThrowable()) { - //Console.WriteLine(t.StackTrace); + //t.PrintStackTrace(Console.Out); if (noErrors) { Console.WriteLine(Thread.CurrentThread.Name + ": ERROR: unexpected Throwable:"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); error = t; } break; @@ -626,7 +626,7 @@ public override void Run() { failed = true; failure = e; - Console.WriteLine(e.ToString()); + failure.PrintStackTrace(Console.Out); // return; // LUCENENET: redundant return } } diff --git a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs index c0d93b747a..baad17d267 100644 --- a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs @@ -140,7 +140,7 @@ public override void Run() } catch (Exception ex) when (ex.IsThrowable()) { - Console.WriteLine(ex.StackTrace); + ex.PrintStackTrace(Console.Out); this.ex = ex; run = false; } diff --git a/src/Lucene.Net.Tests/Index/TestPayloads.cs b/src/Lucene.Net.Tests/Index/TestPayloads.cs index 1affe6ba57..4733a94bf1 100644 --- a/src/Lucene.Net.Tests/Index/TestPayloads.cs +++ b/src/Lucene.Net.Tests/Index/TestPayloads.cs @@ -557,7 +557,7 @@ public override void Run() } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(); Assert.Fail(e.ToString()); } } diff --git a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs index 2f94be2a55..8324102931 100644 --- a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs @@ -206,7 +206,7 @@ public override void Run() } catch (Exception t) when (t.IsThrowable()) { - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); Assert.Fail("addDocument failed"); } if (i % 2 == 0) diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs index 253060403a..dfd8c28c49 100644 --- a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs +++ b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs @@ -69,7 +69,7 @@ public override void Run() catch (Exception e) when (e.IsThrowable()) { Console.WriteLine(Thread.CurrentThread + ": exc"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); failed = true; } } diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs index 41e9818ff5..5da67a1de9 100644 --- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs +++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs @@ -1042,8 +1042,7 @@ public override void Run() } catch (Exception e) when (e.IsThrowable()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); Assert.Fail(e.ToString()); } diff --git a/src/Lucene.Net.Tests/Index/TestStressNRT.cs b/src/Lucene.Net.Tests/Index/TestStressNRT.cs index 5b46b6fd8f..4780a0d860 100644 --- a/src/Lucene.Net.Tests/Index/TestStressNRT.cs +++ b/src/Lucene.Net.Tests/Index/TestStressNRT.cs @@ -419,7 +419,7 @@ public override void Run() catch (Exception e) when (e.IsThrowable()) { Console.WriteLine(Thread.CurrentThread.Name + ": FAILED: unexpected exception"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); throw RuntimeException.Create(e); } } @@ -546,7 +546,7 @@ public override void Run() { operations.Value = (int)-1L; Console.WriteLine(Thread.CurrentThread.Name + ": FAILED: unexpected exception"); - Console.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); throw RuntimeException.Create(e); } } diff --git a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs index 56d4bdd323..0158961553 100644 --- a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs +++ b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs @@ -169,7 +169,7 @@ public override void Run() { outerInstance.SetFailed(); Console.WriteLine(Thread.CurrentThread.Name + ": hit exception"); - Console.WriteLine(t.StackTrace); + t.PrintStackTrace(Console.Out); } } } diff --git a/src/Lucene.Net.Tests/Index/TestTransactions.cs b/src/Lucene.Net.Tests/Index/TestTransactions.cs index 4ff4e42731..0604ecedf9 100644 --- a/src/Lucene.Net.Tests/Index/TestTransactions.cs +++ b/src/Lucene.Net.Tests/Index/TestTransactions.cs @@ -87,7 +87,7 @@ public override void Run() catch (Exception e) when (e.IsThrowable()) { Console.WriteLine(Thread.CurrentThread + ": exc"); - Console.Error.WriteLine(e.StackTrace); + e.PrintStackTrace(Console.Out); failed = true; } } diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs index e94b0da9f2..19d119ba35 100644 --- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs +++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs @@ -475,7 +475,7 @@ public override void Run() } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(); } finally { diff --git a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs index 0d06ec9d6a..75ae3621ca 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs @@ -101,8 +101,7 @@ public virtual void Test() } catch (Exception ioe) when (ioe.IsIOException()) { - Console.WriteLine(ioe.ToString()); - Console.Write(ioe.StackTrace); + ioe.PrintStackTrace(); } } } @@ -187,7 +186,7 @@ public void Run() } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(); } return; } diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs index 5e2fe78eb3..932a4e196a 100644 --- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs +++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs @@ -173,9 +173,10 @@ public override void Run() if (Verbose) { Console.WriteLine("TEST: reopen thread hit exc"); - Console.Out.Write(t.StackTrace); + t.PrintStackTrace(Console.Out); } - outerInstance.m_failed.Value = (true); + + outerInstance.m_failed.Value = true; throw RuntimeException.Create(t); } } @@ -400,7 +401,7 @@ public void Run() if (Verbose) { Console.WriteLine("FAIL: unexpected exc"); - Console.Out.Write(e.StackTrace); + e.PrintStackTrace(Console.Out); } exc[0] = e; // use success as the barrier here to make sure we see the write diff --git a/src/Lucene.Net.Tests/Search/TestShardSearching.cs b/src/Lucene.Net.Tests/Search/TestShardSearching.cs index 219aba5efd..da0aa18017 100644 --- a/src/Lucene.Net.Tests/Search/TestShardSearching.cs +++ b/src/Lucene.Net.Tests/Search/TestShardSearching.cs @@ -294,7 +294,7 @@ public virtual void TestSimple() if (Verbose) { Console.WriteLine(" searcher expired during search: " + see); - Console.Out.Write(see.StackTrace); + see.PrintStackTrace(Console.Out); } // We can't do this in general: on a very slow // computer it's possible the local searcher diff --git a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs index 20fa9066ac..88fb8dbf52 100644 --- a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs +++ b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs @@ -158,7 +158,7 @@ private void DoTestSearch() } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(); assertTrue("Unexpected exception: " + e, false); //==fail } assertEquals("Wrong number of results!", totalResults, totalTLCResults); diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs index 70d8c1d554..4a7301220b 100644 --- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs +++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs @@ -100,7 +100,7 @@ public virtual void TestRAMDirectoryNoLocking() } catch (Exception e) when (e.IsException()) { - e.printStackTrace(); + e.PrintStackTrace(Console.Out); Assert.Fail("Should not have hit an IOException with no locking"); } @@ -316,8 +316,8 @@ public override void Run() if (e.ToString().IndexOf(" timed out:", StringComparison.Ordinal) == -1) { HitException = true; - Console.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToString()); - Console.Out.Write(e.StackTrace); + Console.WriteLine("Stress Test Index Writer: creation hit unexpected IOException: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); } else { @@ -332,8 +332,8 @@ public override void Run() catch (Exception e) when (e.IsException()) { HitException = true; - Console.WriteLine("Stress Test Index Writer: creation hit unexpected exception: " + e.ToString()); - e.printStackTrace(Console.Out); + Console.WriteLine("Stress Test Index Writer: creation hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } if (writer != null) @@ -345,8 +345,8 @@ public override void Run() catch (Exception e) when (e.IsIOException()) { HitException = true; - Console.WriteLine("Stress Test Index Writer: addDoc hit unexpected exception: " + e.ToString()); - Console.Out.Write(e.StackTrace); + Console.WriteLine("Stress Test Index Writer: addDoc hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } try @@ -356,8 +356,8 @@ public override void Run() catch (Exception e) when (e.IsIOException()) { HitException = true; - Console.WriteLine("Stress Test Index Writer: close hit unexpected exception: " + e.ToString()); - Console.Out.Write(e.StackTrace); + Console.WriteLine("Stress Test Index Writer: close hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } writer = null; @@ -393,8 +393,8 @@ public override void Run() catch (Exception e) when (e.IsException()) { HitException = true; - Console.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToString()); - e.printStackTrace(Console.Out); + Console.WriteLine("Stress Test Index Searcher: create hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } try @@ -404,8 +404,8 @@ public override void Run() catch (Exception e) when (e.IsIOException()) { HitException = true; - Console.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToString()); - Console.Out.Write(e.StackTrace); + Console.WriteLine("Stress Test Index Searcher: search hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } // System.out.println(hits.Length() + " total results"); @@ -416,8 +416,8 @@ public override void Run() catch (Exception e) when (e.IsIOException()) { HitException = true; - Console.WriteLine("Stress Test Index Searcher: close hit unexpected exception: " + e.ToString()); - Console.Out.Write(e.StackTrace); + Console.WriteLine("Stress Test Index Searcher: close hit unexpected exception: " + e.ToTypeMessageString()); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior + e.PrintStackTrace(Console.Out); break; } } diff --git a/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs b/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs new file mode 100644 index 0000000000..b041d86ad6 --- /dev/null +++ b/src/Lucene.Net.Tests/Support/Text/TestStringExtensions.cs @@ -0,0 +1,48 @@ +using Lucene.Net.Attributes; +using Lucene.Net.Util; +using NUnit.Framework; +#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON +using System; +#endif + +namespace Lucene.Net.Support.Text +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + [TestFixture, LuceneNetSpecific] + public class TestStringExtensions : LuceneTestCase + { + [Test] + public void TestContainsAny() + { + Assert.IsTrue("hello".ContainsAny(new[] { 'h', 'e', 'l', 'o' })); + Assert.IsFalse("hello".ContainsAny(new[] { 'x', 'y', 'z' })); + } + +#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON + [Test] + public void TestContainsWithStringComparison() + { + Assert.IsTrue("hello".Contains("ell", StringComparison.Ordinal)); + Assert.IsFalse("hello".Contains("world", StringComparison.Ordinal)); + Assert.IsTrue("hello".Contains("ELL", StringComparison.OrdinalIgnoreCase)); + Assert.IsFalse("hello".Contains("WORLD", StringComparison.OrdinalIgnoreCase)); + } +#endif + } +} diff --git a/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs b/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs index bdd1362944..990b2cd357 100644 --- a/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs +++ b/src/Lucene.Net.Tests/Support/Threading/JSR166TestCase.cs @@ -322,7 +322,7 @@ public void threadUnexpectedException() public void threadUnexpectedException(Exception ex) { threadFailed = true; - ex.printStackTrace(); + ex.PrintStackTrace(); fail("Unexpected exception: " + ex); } diff --git a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs index 3b2e89ec11..ef01e20214 100644 --- a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs +++ b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs @@ -382,7 +382,7 @@ private static void AssertRandomEquality(int valueCount, int bitsPerValue, long } catch (Exception e) when (e.IsException()) { - e.printStackTrace(Console.Error); + e.PrintStackTrace(Console.Error); Assert.Fail(string.Format(CultureInfo.InvariantCulture, "Exception while filling {0}: valueCount={1}, bitsPerValue={2}", packedInt.GetType().Name, valueCount, bitsPerValue)); } } diff --git a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs index 12945998b8..68dcc7ccd5 100644 --- a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs +++ b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs @@ -130,8 +130,7 @@ public virtual void TestParseInt() } catch (Exception e) when (e.IsNumberFormatException()) { - Console.WriteLine(e.ToString()); - Console.Write(e.StackTrace); + e.PrintStackTrace(); Assert.IsTrue(false); } } diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs index 6eb9d94c89..f06bd1fe18 100644 --- a/src/Lucene.Net/Index/CheckIndex.cs +++ b/src/Lucene.Net/Index/CheckIndex.cs @@ -520,11 +520,10 @@ public virtual Status DoCheckIndex(IList onlySegments) Msg(infoStream, "ERROR: could not read any segments file in directory"); result.MissingSegments = true; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(t.ToString()); - //infoStream.WriteLine(t.StackTrace); + if (infoStream != null) + { + t.PrintStackTrace(infoStream); + } return result; } @@ -568,11 +567,10 @@ public virtual Status DoCheckIndex(IList onlySegments) { Msg(infoStream, "ERROR: could not open segments file in directory"); - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(t.ToString()); - //infoStream.WriteLine(t.StackTrace); + if (infoStream != null) + { + t.PrintStackTrace(infoStream); + } result.CantOpenSegments = true; return result; @@ -586,11 +584,10 @@ public virtual Status DoCheckIndex(IList onlySegments) { Msg(infoStream, "ERROR: could not read segment file version in directory"); - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(t.ToString()); - //infoStream.WriteLine(t.StackTrace); + if (infoStream != null) + { + t.PrintStackTrace(infoStream); + } result.MissingSegmentVersion = true; return result; @@ -874,10 +871,10 @@ public virtual Status DoCheckIndex(IList onlySegments) comment = "fixIndex() would remove reference to this segment"; Msg(infoStream, " WARNING: " + comment + "; full exception:"); - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(t.ToString()); + if (infoStream != null) + { + t.PrintStackTrace(infoStream); + } Msg(infoStream, ""); result.TotLoseDocCount += toLoseDocCount; @@ -960,11 +957,10 @@ public static Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWri Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + if (infoStream != null) + { + e.PrintStackTrace(infoStream); + } } return status; @@ -1666,11 +1662,10 @@ public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWrite status = new Status.TermIndexStatus(); status.Error = e; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + if (infoStream != null) + { + e.PrintStackTrace(infoStream); + } } return status; @@ -1716,11 +1711,10 @@ public static Status.StoredFieldStatus TestStoredFields(AtomicReader reader, Tex Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + if (infoStream != null) + { + e.PrintStackTrace(infoStream); + } } return status; @@ -1761,11 +1755,10 @@ public static Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWrit Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + if (infoStream != null) + { + e.PrintStackTrace(infoStream); + } } return status; } @@ -2284,11 +2277,10 @@ public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextW Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - // LUCENENET NOTE: Some tests rely on the error type being in - // the message. We can't get the error type with StackTrace, we - // need ToString() for that. - infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + if (infoStream != null) + { + e.PrintStackTrace(infoStream); + } } return status; diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs index 85b7a8eeea..4ad0b7c235 100644 --- a/src/Lucene.Net/Index/IndexFileDeleter.cs +++ b/src/Lucene.Net/Index/IndexFileDeleter.cs @@ -249,7 +249,7 @@ public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, Segment } catch (Exception e) when (e.IsIOException()) { - throw new CorruptIndexException("failed to locate current segments_N file \"" + currentSegmentsFile + "\"" + e.ToString(), e); + throw new CorruptIndexException("failed to locate current segments_N file \"" + currentSegmentsFile + "\"" + e, e); // LUCENENET specific: add exception logging and inner exception } if (infoStream.IsEnabled("IFD")) { @@ -694,7 +694,7 @@ internal void DeleteFile(string fileName) if (infoStream.IsEnabled("IFD")) { infoStream.Message("IFD", - "unable to remove file \"" + fileName + "\": " + e.ToString() + "; Will re-try later."); + "unable to remove file \"" + fileName + "\": " + e.ToTypeMessageString() + "; Will re-try later."); // LUCENENET specific: use ToTypeMessageString to mimic Java behavior } if (deletable is null) { diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs index 08464b59e5..ef25545cae 100644 --- a/src/Lucene.Net/Search/FieldCacheImpl.cs +++ b/src/Lucene.Net/Search/FieldCacheImpl.cs @@ -427,7 +427,7 @@ private void PrintNewInsanity(TextWriter infoStream, TValue value) // OK this insanity involves our entry infoStream.WriteLine("WARNING: new FieldCache insanity created\nDetails: " + insanity.ToString()); infoStream.WriteLine("\nStack:\n"); - infoStream.WriteLine(new Exception().StackTrace); + StackTraceHelper.PrintCurrentStackTrace(infoStream); break; } } @@ -486,7 +486,7 @@ public override int GetHashCode() // LUCENENET specific - Added generic parameter to eliminate casting/boxing internal class CacheKey : CacheKey { - internal readonly TCustom custom; // which custom comparer or parser + internal readonly TCustom custom; // which custom comparer or parser /// /// Creates one of these objects for a custom comparer/parser. @@ -775,7 +775,7 @@ protected override TermsEnum GetTermsEnum(Terms terms) /// Checks the internal cache for an appropriate entry, and if none is /// found, reads the terms in as s and returns an array /// of size reader.MaxDoc of the value each document - /// has in the given field. + /// has in the given field. /// /// NOTE: this was getShorts() in Lucene /// @@ -795,7 +795,7 @@ public virtual FieldCache.Int16s GetInt16s(AtomicReader reader, string field, bo /// Checks the internal cache for an appropriate entry, and if none is found, /// reads the terms in as shorts and returns an array of /// size reader.MaxDoc of the value each document has in the - /// given field. + /// given field. /// /// NOTE: this was getShorts() in Lucene /// diff --git a/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs b/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs index 09ba5bdf78..d422c7d646 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/ExceptionExtensions.cs @@ -8,6 +8,7 @@ using System.Security; using System.Text; using System.Threading; +using PublicExceptionExtensions = Lucene.Net.Util.ExceptionExtensions; namespace Lucene { @@ -698,5 +699,68 @@ public static bool IsServiceConfigurationError(this Exception e) // it is not sensible to make a public exception that will be factored out along with it. return e is ServiceConfigurationError; } + + /// + /// Prints the stack trace of the exception to the console's standard error output stream. + /// + /// This method mimics Java's behavior of printing the exception type and message first before the stack trace. + /// In .NET, this is done by calling . + /// Additionally, it will print any suppressed exceptions stored in + /// via . + /// + /// The exception to print. + public static void PrintStackTrace(this Exception e) + { + Console.Error.WriteLine(FormatStackTrace(e)); + } + + /// + /// Prints the stack trace of the exception to the specified . + /// + /// This method mimics Java's behavior of printing the exception type and message first before the stack trace. + /// In .NET, this is done by calling . + /// Additionally, it will print any suppressed exceptions stored in + /// via . + /// + /// The exception to print. + /// The destination to write the stack trace to. + public static void PrintStackTrace(this Exception e, TextWriter destination) + { + destination.WriteLine(FormatStackTrace(e)); + } + + private static string FormatStackTrace(this Exception e) + { + var suppressed = PublicExceptionExtensions.GetSuppressedAsListOrDefault(e); + + if (suppressed == null) + { + return e.ToString(); + } + + StringBuilder sb = new(); + sb.AppendLine(e.ToString()); + + foreach (var suppressedException in suppressed) + { + sb.Append("Suppressed: ").AppendLine(suppressedException.ToString()); + } + + return sb.ToString(); + } + + /// + /// Gets a string representation of the exception, including the exception type and message. + /// + /// In Java, calling toString() on an exception returns the exception type and message, + /// without the stack trace. This method mimics that behavior. + /// + /// The exception to get the string representation of. + /// A string representation of the exception, including the exception type and message. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string ToTypeMessageString(this Exception e) + { + return $"{e.GetType().FullName}: {e.Message}"; + } } } diff --git a/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs b/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs new file mode 100644 index 0000000000..ba31f9aafe --- /dev/null +++ b/src/Lucene.Net/Support/ExceptionHandling/StackTraceHelper.cs @@ -0,0 +1,111 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Runtime.CompilerServices; +#nullable enable + +namespace Lucene.Net.Util +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /// + /// LUCENENET specific class to provide some additional functionality around stack traces. + /// + internal static class StackTraceHelper + { + /// + /// Matches the StackTrace for a method name. + /// + /// IMPORTANT: To make the tests pass in release mode, the method(s) named here + /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)]. + /// + public static bool DoesStackTraceContainMethod(string methodName) + { + if (methodName is null) + { + throw new ArgumentNullException(nameof(methodName)); + } + + StackTrace trace = new StackTrace(); + // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract + StackFrame[] frames = trace.GetFrames() ?? Array.Empty(); // NOTE: .NET Framework can return null here + + foreach (var frame in frames) + { + if (frame.GetMethod()?.Name.Equals(methodName, StringComparison.Ordinal) == true) + { + return true; + } + } + + return false; + } + + /// + /// Matches the StackTrace for a particular class (not fully-qualified) and method name. + /// + /// IMPORTANT: To make the tests pass in release mode, the method(s) named here + /// must be decorated with [MethodImpl(MethodImplOptions.NoInlining)]. + /// + public static bool DoesStackTraceContainMethod(string className, string methodName) + { + if (className is null) + { + throw new ArgumentNullException(nameof(className)); + } + if (methodName is null) + { + throw new ArgumentNullException(nameof(methodName)); + } + + StackTrace trace = new StackTrace(); + // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract + StackFrame[] frames = trace.GetFrames() ?? Array.Empty(); // NOTE: .NET Framework can return null here + + foreach (var frame in frames) + { + var method = frame.GetMethod(); + if (method?.DeclaringType?.Name.Equals(className, StringComparison.Ordinal) == true + && method.Name.Equals(methodName, StringComparison.Ordinal)) + { + return true; + } + } + + return false; + } + + /// + /// Prints the current stack trace to the specified . + /// + /// This is equivalent to Java's new Throwable().printStackTrace(destination) + /// or new Exception().printStackTrace(destination). + /// + /// The destination to write the stack trace to. + [MethodImpl(MethodImplOptions.NoInlining)] // Top frame is skipped, so we don't want to inline + public static void PrintCurrentStackTrace(TextWriter destination) + { + if (destination is null) + { + throw new ArgumentNullException(nameof(destination)); + } + + destination.WriteLine(new StackTrace(skipFrames: 1).ToString()); + } + } +} diff --git a/src/Lucene.Net/Support/Text/StringExtensions.cs b/src/Lucene.Net/Support/Text/StringExtensions.cs index eae0842233..dd72e3f29f 100644 --- a/src/Lucene.Net/Support/Text/StringExtensions.cs +++ b/src/Lucene.Net/Support/Text/StringExtensions.cs @@ -48,5 +48,26 @@ public static bool ContainsAny(this string input, char[] charsToCompare) } return false; } + +#if !FEATURE_STRING_CONTAINS_STRINGCOMPARISON + /// + /// Returns true if contains + /// using the specified . + /// + /// The string in which to seek . + /// The string to check for. + /// The to use. + /// true if is found, otherwise; false. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool Contains(this string input, string value, StringComparison comparison) + { + if (input is null) + throw new ArgumentNullException(nameof(input)); + if (value is null) + throw new ArgumentNullException(nameof(value)); + + return input.AsSpan().Contains(value.AsSpan(), comparison); + } +#endif } } diff --git a/src/Lucene.Net/Support/Util/ExceptionExtensions.cs b/src/Lucene.Net/Support/Util/ExceptionExtensions.cs index 8528498cad..d62ccedd7a 100644 --- a/src/Lucene.Net/Support/Util/ExceptionExtensions.cs +++ b/src/Lucene.Net/Support/Util/ExceptionExtensions.cs @@ -1,8 +1,8 @@ using J2N.Collections.Generic.Extensions; using System; using System.Collections.Generic; -using System.Linq; using JCG = J2N.Collections.Generic; +#nullable enable namespace Lucene.Net.Util { @@ -46,12 +46,20 @@ public static IList GetSuppressedAsList(this Exception e) } else { - suppressed = e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList; + suppressed = e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList + ?? throw new InvalidOperationException($"Unexpected type for suppressed exceptions list: {e.Data[SUPPRESSED_EXCEPTIONS_KEY]?.GetType()}"); } return suppressed; } + public static IList? GetSuppressedAsListOrDefault(this Exception e) + { + return e.Data.Contains(SUPPRESSED_EXCEPTIONS_KEY) + ? e.Data[SUPPRESSED_EXCEPTIONS_KEY] as IList + : null; + } + public static void AddSuppressed(this Exception e, Exception exception) { e.GetSuppressedAsList().Add(exception); From 728d5557b9b5fcd5e8e5f833d2a857ae2353a772 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Sun, 19 Jan 2025 08:52:06 -0700 Subject: [PATCH 2/6] SWEEP: Make private/internal fields readonly where possible, #661 (#1103) --- .../Analysis/Br/BrazilianAnalyzer.cs | 8 ++-- .../CharFilter/HTMLStripCharFilter.cs | 12 ++--- .../Analysis/Cjk/CJKWidthFilter.cs | 8 ++-- .../Analysis/Cn/ChineseFilter.cs | 10 ++-- .../Compound/Hyphenation/ByteVector.cs | 12 ++--- .../Compound/Hyphenation/CharVector.cs | 14 +++--- .../Compound/Hyphenation/PatternParser.cs | 2 +- .../Compound/Hyphenation/TernaryTree.cs | 20 ++++---- .../Analysis/En/EnglishPossessiveFilter.cs | 12 ++--- .../Analysis/En/KStemmer.cs | 18 +++---- .../Analysis/Hunspell/Dictionary.cs | 8 ++-- .../Analysis/Lv/LatvianStemmer.cs | 12 ++--- .../CapitalizationFilterFactory.cs | 12 ++--- .../WordDelimiterFilterFactory.cs | 6 +-- .../Analysis/Nl/DutchAnalyzer.cs | 2 +- .../PatternCaptureGroupFilterFactory.cs | 10 ++-- .../Pattern/PatternCaptureGroupTokenFilter.cs | 26 +++++----- .../Payloads/NumericPayloadTokenFilter.cs | 8 ++-- .../Analysis/Snowball/SnowballAnalyzer.cs | 20 ++++---- .../Analysis/Synonym/SynonymMap.cs | 2 +- .../Language/Bm/PhoneticEngine.cs | 2 +- .../PhoneticFilterFactory.cs | 4 +- .../Egothor.Stemmer/Row.cs | 2 +- .../Egothor.Stemmer/Trie.cs | 6 +-- .../ByTask/Feeds/DirContentSource.cs | 2 +- .../ByTask/Feeds/DocMaker.cs | 6 +-- .../ByTask/Stats/TaskStats.cs | 14 +++--- .../Quality/Trec/TrecJudge.cs | 2 +- .../Quality/Utils/QualityQueriesFinder.cs | 4 +- .../Memory/FSTTermsReader.cs | 4 +- .../Memory/MemoryPostingsFormat.cs | 2 +- .../ExpressionRescorer.cs | 2 +- .../Directory/DirectoryTaxonomyWriter.cs | 2 +- .../Taxonomy/WriterCache/CharBlockArray.cs | 4 +- .../Taxonomy/WriterCache/CollisionMap.cs | 22 ++++----- .../WriterCache/CompactLabelToOrdinal.cs | 6 +-- .../Term/TermAllGroupHeadsCollector.cs | 14 +++--- .../Highlight/SimpleHTMLFormatter.cs | 8 ++-- .../Highlight/TokenGroup.cs | 4 +- .../Highlight/TokenSources.cs | 10 ++-- .../PostingsHighlight/PostingsHighlighter.cs | 4 +- .../VectorHighlight/FieldPhraseList.cs | 2 +- .../VectorHighlight/FieldQuery.cs | 8 ++-- .../VectorHighlight/FieldTermStack.cs | 2 +- src/Lucene.Net.Memory/MemoryIndex.Info.cs | 16 +++---- .../MemoryIndex.MemoryIndexReader.cs | 2 +- src/Lucene.Net.Misc/Document/LazyDocument.cs | 4 +- src/Lucene.Net.Misc/Index/IndexSplitter.cs | 4 +- .../Classic/FastCharStream.cs | 32 ++++++------- .../Classic/QueryParserTokenManager.cs | 2 +- .../StandardSyntaxParserTokenManager.cs | 2 +- .../Surround/Parser/FastCharStream.cs | 8 ++-- .../Parser/QueryParserTokenManager.cs | 2 +- .../Queries/FuzzyLikeThisQuery.cs | 8 ++-- .../Prefix/ContainsPrefixTreeFilter.cs | 2 +- .../Spell/HighFrequencyDictionary.cs | 8 ++-- .../Spell/TermFreqIterator.cs | 6 +-- ...gInfixSuggesterIndexWriterConfigFactory.cs | 10 ++-- .../Suggest/FileDictionary.cs | 16 +++---- .../Suggest/Tst/TSTLookup.cs | 8 ++-- .../Analysis/MockCharFilter.cs | 4 +- .../Codecs/Lucene3x/PreFlexRWFieldsWriter.cs | 4 +- .../Codecs/Lucene3x/TermInfosWriter.cs | 6 +-- .../Lucene42/Lucene42DocValuesConsumer.cs | 4 +- .../Search/CheckHits.cs | 8 ++-- .../Store/MockDirectoryWrapper.cs | 4 +- .../Store/MockIndexOutputWrapper.cs | 2 +- .../Store/MockLockFactoryWrapper.cs | 10 ++-- src/Lucene.Net/Codecs/BlockTreeTermsReader.cs | 2 +- .../Codecs/Lucene3x/SegmentTermEnum.cs | 12 ++--- .../Codecs/Lucene3x/TermInfosReader.cs | 2 +- .../Lucene40/Lucene40TermVectorsWriter.cs | 2 +- src/Lucene.Net/Document/Field.cs | 48 +++++++++---------- .../Index/ConcurrentMergeScheduler.cs | 10 ++-- .../Index/DocumentsWriterPerThread.cs | 2 +- .../Index/FreqProxTermsWriterPerField.cs | 10 ++-- src/Lucene.Net/Index/FrozenBufferedUpdates.cs | 4 +- src/Lucene.Net/Index/IndexFileDeleter.cs | 10 ++-- src/Lucene.Net/Index/IndexWriter.cs | 2 +- .../Index/StandardDirectoryReader.cs | 10 ++-- .../Index/TermVectorsConsumerPerField.cs | 10 ++-- src/Lucene.Net/Search/BooleanScorer2.cs | 6 +-- .../Search/ConstantScoreAutoRewrite.cs | 2 +- src/Lucene.Net/Search/ExactPhraseScorer.cs | 4 +- src/Lucene.Net/Search/FieldCacheImpl.cs | 2 +- .../Search/Payloads/PayloadNearQuery.cs | 4 +- src/Lucene.Net/Search/PhrasePositions.cs | 4 +- src/Lucene.Net/Search/PhraseQuery.cs | 2 +- src/Lucene.Net/Search/ScoringRewrite.cs | 2 +- src/Lucene.Net/Search/SortField.cs | 2 +- .../Search/Spans/NearSpansUnordered.cs | 4 +- src/Lucene.Net/Store/SimpleFSLockFactory.cs | 12 ++--- .../Store/SingleInstanceLockFactory.cs | 4 +- .../Util/Automaton/LevenshteinAutomata.cs | 6 +-- src/Lucene.Net/Util/Automaton/RegExp.cs | 30 ++++++------ src/Lucene.Net/Util/Automaton/SortedIntSet.cs | 8 ++-- src/Lucene.Net/Util/Automaton/State.cs | 2 +- src/Lucene.Net/Util/Automaton/StatePair.cs | 4 +- src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs | 2 +- src/Lucene.Net/Util/CollectionUtil.cs | 12 ++--- .../Util/IndexableBinaryStringTools.cs | 4 +- .../Packed/AbstractAppendingLongBuffer.cs | 18 +++---- src/Lucene.Net/Util/PriorityQueue.cs | 1 + src/Lucene.Net/Util/RollingBuffer.cs | 4 +- src/Lucene.Net/Util/TimSorter.cs | 2 +- 105 files changed, 398 insertions(+), 397 deletions(-) diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs index 83c341e541..5cfc5b420d 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianAnalyzer.cs @@ -28,13 +28,13 @@ namespace Lucene.Net.Analysis.Br */ /// - /// for Brazilian Portuguese language. + /// for Brazilian Portuguese language. /// /// Supports an external list of stopwords (words that /// will not be indexed at all) and an external list of exclusions (words that will /// not be stemmed, but indexed). /// - /// + /// /// NOTE: This class uses the same /// dependent settings as . /// @@ -77,7 +77,7 @@ private static CharArraySet LoadDefaultStopSet() // LUCENENET: Avoid static cons /// /// Contains words that should be indexed but not stemmed. /// - private CharArraySet excltable = CharArraySet.Empty; + private readonly CharArraySet excltable = CharArraySet.Empty; // LUCENENET: marked readonly /// /// Builds an analyzer with the default stop words (). @@ -135,4 +135,4 @@ protected internal override TokenStreamComponents CreateComponents(string fieldN return new TokenStreamComponents(source, new BrazilianStemFilter(result)); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs index d18149ee2e..899c79588d 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/HTMLStripCharFilter.cs @@ -30792,19 +30792,19 @@ CharArrayDictionary result private static readonly char STYLE_REPLACEMENT = '\n'; private static readonly char REPLACEMENT_CHARACTER = '\uFFFD'; - private CharArraySet escapedTags = null; + private readonly CharArraySet escapedTags = null; // LUCENENET: marked readonly private int inputStart; private int cumulativeDiff; - private bool escapeBR = false; - private bool escapeSCRIPT = false; - private bool escapeSTYLE = false; + private readonly bool escapeBR = false; // LUCENENET: marked readonly + private readonly bool escapeSCRIPT = false; // LUCENENET: marked readonly + private readonly bool escapeSTYLE = false; // LUCENENET: marked readonly private int restoreState; private int previousRestoreState; private int outputCharCount; private int eofReturnValue; - private TextSegment inputSegment = new TextSegment(INITIAL_INPUT_SEGMENT_SIZE); + private readonly TextSegment inputSegment = new TextSegment(INITIAL_INPUT_SEGMENT_SIZE); // LUCENENET: marked readonly private TextSegment outputSegment; - private TextSegment entitySegment = new TextSegment(2); + private readonly TextSegment entitySegment = new TextSegment(2); // LUCENENET: marked readonly /// /// Creates a new HTMLStripCharFilter over the provided TextReader. diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs index 739c30b42a..1e2284f715 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Cjk/CJKWidthFilter.cs @@ -35,13 +35,13 @@ namespace Lucene.Net.Analysis.Cjk /// public sealed class CJKWidthFilter : TokenFilter { - private ICharTermAttribute termAtt; + private readonly ICharTermAttribute termAtt; // LUCENENET: marked readonly /// - /// halfwidth kana mappings: 0xFF65-0xFF9D + /// halfwidth kana mappings: 0xFF65-0xFF9D /// /// note: 0xFF9C and 0xFF9D are only mapped to 0x3099 and 0x309A - /// as a fallback when they cannot properly combine with a preceding + /// as a fallback when they cannot properly combine with a preceding /// character into a composed form. /// private static readonly char[] KANA_NORM = new char[] { @@ -124,4 +124,4 @@ private static bool Combine(char[] text, int pos, char ch) return false; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs index 36d0a76ea9..ce44bc03d4 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Cn/ChineseFilter.cs @@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Cn */ /// - /// A with a stop word table. + /// A with a stop word table. /// /// Numeric tokens are removed. /// English tokens must be larger than 1 character. @@ -39,7 +39,7 @@ namespace Lucene.Net.Analysis.Cn /// /// /// @deprecated (3.1) Use instead, which has the same functionality. - /// This filter will be removed in Lucene 5.0 + /// This filter will be removed in Lucene 5.0 [Obsolete("(3.1) Use StopFilter instead, which has the same functionality.")] public sealed class ChineseFilter : TokenFilter { @@ -52,9 +52,9 @@ public sealed class ChineseFilter : TokenFilter "they", "this", "to", "was", "will", "with" }; - private CharArraySet stopTable; + private readonly CharArraySet stopTable; // LUCENENET: marked readonly - private ICharTermAttribute termAtt; + private readonly ICharTermAttribute termAtt; // LUCENENET: marked readonly public ChineseFilter(TokenStream @in) : base(@in) @@ -97,4 +97,4 @@ public override bool IncrementToken() return false; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs index aa025163b6..82a0fef094 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/ByteVector.cs @@ -11,9 +11,9 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation /// /// This class implements a simple byte vector with access to the underlying /// array. - /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. + /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. /// public class ByteVector { @@ -33,7 +33,7 @@ public class ByteVector /// private const int DEFAULT_BLOCK_SIZE = 2048; - private int blockSize; + private readonly int blockSize; // LUCENENET: marked readonly /// /// The encapsulated array @@ -45,7 +45,7 @@ public class ByteVector /// private int n; - public ByteVector() + public ByteVector() : this(DEFAULT_BLOCK_SIZE) { } @@ -148,4 +148,4 @@ public virtual void TrimToSize() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs index 854e053bbe..0bac76692b 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/CharVector.cs @@ -12,9 +12,9 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,8 +25,8 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation /// /// This class implements a simple char vector with access to the underlying /// array. - /// - /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. + /// + /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. /// public class CharVector // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation { @@ -35,7 +35,7 @@ public class CharVector // LUCENENET specific: Not implementing ICloneable per M /// private const int DEFAULT_BLOCK_SIZE = 2048; - private int blockSize; + private readonly int blockSize; // LUCENENET: marked readonly /// /// The encapsulated array @@ -47,7 +47,7 @@ public class CharVector // LUCENENET specific: Not implementing ICloneable per M /// private int n; - public CharVector() + public CharVector() : this(DEFAULT_BLOCK_SIZE) { } @@ -160,4 +160,4 @@ public virtual void TrimToSize() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs index 520e87b707..3f5b829797 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs @@ -40,7 +40,7 @@ public class PatternParser internal IPatternConsumer consumer; - internal StringBuilder token; + internal readonly StringBuilder token; // LUCENENET: marked readonly internal IList exception; diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs index 1f439e2862..dd6dbe6161 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/TernaryTree.cs @@ -15,9 +15,9 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation /// ///

Ternary Search Tree.

- /// + /// /// /// A ternary search tree is a hybrid between a binary tree and a digital search /// tree (trie). Keys are limited to strings. A data value of type char is stored @@ -42,7 +42,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation /// trie. Performance is comparable with a hash table, sometimes it outperforms a /// hash function (most of the time can determine a miss faster than a hash). /// - /// + /// /// /// The main purpose of this java port is to serve as a base for implementing /// TeX's hyphenation algorithm (see The TeXBook, appendix H). Each language @@ -56,15 +56,15 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation /// tests the english patterns took 7694 nodes and the german patterns 10055 /// nodes, so I think we are safe. /// - /// + /// /// /// All said, this is a map with strings as keys and char as value. Pretty /// limited!. It can be extended to a general map by using the string /// representation of an object and using the char value as an index to an array /// that contains the object values. /// - /// - /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. + /// + /// This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified. ///
public class TernaryTree // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation @@ -475,7 +475,7 @@ public virtual void Balance() /// tree is traversed to find the key substrings actually used. In addition, /// duplicate substrings are removed using a map (implemented with a /// TernaryTree!). - /// + /// /// public virtual void TrimToSize() { @@ -560,7 +560,7 @@ public class Enumerator : IEnumerator private class Item // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation { - internal char parent; + internal readonly char parent; // LUCENENET: marked readonly internal char child; // LUCENENET: This constructor is unnecessary @@ -814,4 +814,4 @@ public static void main(String[] args) { */ } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishPossessiveFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishPossessiveFilter.cs index e9849b7641..bbb0e0fec9 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishPossessiveFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishPossessiveFilter.cs @@ -27,7 +27,7 @@ namespace Lucene.Net.Analysis.En /// You must specify the required /// compatibility when creating : /// - /// As of 3.6, U+2019 RIGHT SINGLE QUOTATION MARK and + /// As of 3.6, U+2019 RIGHT SINGLE QUOTATION MARK and /// U+FF07 FULLWIDTH APOSTROPHE are also treated as /// quotation marks. /// @@ -36,16 +36,16 @@ namespace Lucene.Net.Analysis.En public sealed class EnglishPossessiveFilter : TokenFilter { private readonly ICharTermAttribute termAtt; - private LuceneVersion matchVersion; + private readonly LuceneVersion matchVersion; // LUCENENET: marked readonly - /// @deprecated Use instead. + /// @deprecated Use instead. [Obsolete(@"Use instead.")] - public EnglishPossessiveFilter(TokenStream input) + public EnglishPossessiveFilter(TokenStream input) : this(LuceneVersion.LUCENE_35, input) { } - public EnglishPossessiveFilter(LuceneVersion version, TokenStream input) + public EnglishPossessiveFilter(LuceneVersion version, TokenStream input) : base(input) { this.matchVersion = version; @@ -73,4 +73,4 @@ public override bool IncrementToken() return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs index f4c395b687..c0cf949b6b 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs @@ -329,8 +329,8 @@ public class KStemmer internal class DictEntry { - internal bool exception; - internal string root; + internal readonly bool exception; // LUCENENET: marked readonly + internal readonly string root; // LUCENENET: marked readonly internal DictEntry(string root, bool isException) { @@ -341,8 +341,8 @@ internal DictEntry(string root, bool isException) private static readonly CharArrayDictionary dict_ht = InitializeDictHash(); - // caching off - // + // caching off + // // private int maxCacheSize; private CharArrayDictionary{String} cache = // null; private static final String SAME = "SAME"; // use if stemmed form is // the same @@ -809,9 +809,9 @@ private void PastTense() k = j + 1; DictEntry entry = WordInDict(); - if (entry != null) + if (entry != null) { - if (!entry.exception) + if (!entry.exception) { // if it's in the dictionary and // not an exception @@ -1882,7 +1882,7 @@ internal virtual bool Stem(char[] term, int len) //* // caching off is normally faster if (cache is null) initializeStemHash(); - // + // // // now check the cache, before we copy chars to "word" if (cache != null) // { String val = cache.get(term, 0, len); if (val != null) { if (val != // SAME) { result = val; return true; } return false; } } @@ -2026,7 +2026,7 @@ internal virtual bool Stem(char[] term, int len) // if (entry is null) { if (!word.toString().equals(new String(term,0,len), StringComparison.Ordinal)) // { System.out.println("CASE:" + word.toString() + "," + new // String(term,0,len)); - // + // // } } // ** @@ -2034,4 +2034,4 @@ internal virtual bool Stem(char[] term, int len) return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs index 3055bbe2b6..2bcda79add 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs @@ -74,14 +74,14 @@ public class Dictionary // all condition checks used by prefixes and suffixes. these are typically re-used across // many affix stripping rules. so these are deduplicated, to save RAM. - internal IList patterns = new JCG.List(); + internal readonly IList patterns = new JCG.List(); // LUCENENET: marked readonly // the entries in the .dic file, mapping to their set of flags. // the fst output is the ordinal list for flagLookup - internal FST words; + internal readonly FST words; // LUCENENET: marked readonly // the list of unique flagsets (wordforms). theoretically huge, but practically // small (e.g. for polish this is 756), otherwise humans wouldn't be able to deal with it either. - internal BytesRefHash flagLookup = new BytesRefHash(); + internal readonly BytesRefHash flagLookup = new BytesRefHash(); // LUCENENET: marked readonly // the list of unique strip affixes. internal char[] stripData; @@ -111,7 +111,7 @@ public class Dictionary // LUCENENET specific - changed from DirectoryInfo to string private readonly string tempDir = OfflineSorter.DefaultTempDir; // TODO: make this configurable? - internal bool ignoreCase; + internal readonly bool ignoreCase; // LUCENENET: marked readonly internal bool complexPrefixes; internal bool twoStageAffix; // if no affixes have continuation classes, no need to do 2-level affix stripping diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemmer.cs index c7452bc40a..f86cc9a2d3 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemmer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemmer.cs @@ -28,7 +28,7 @@ namespace Lucene.Net.Analysis.Lv /// /// Only explicitly stems noun and adjective morphology /// Stricter length/vowel checks for the resulting stems (verb etc suffix stripping is removed) - /// Removes only the primary inflectional suffixes: case and number for nouns ; + /// Removes only the primary inflectional suffixes: case and number for nouns ; /// case, number, gender, and definitiveness for adjectives. /// Palatalization is only handled when a declension II,V,VI noun suffix is removed. /// @@ -80,9 +80,9 @@ public virtual int Stem(char[] s, int len) internal class Affix { - internal char[] affix; // suffix - internal int vc; // vowel count of the suffix - internal bool palatalizes; // true if we should fire palatalization rules. + internal readonly char[] affix; // suffix // LUCENENET: marked readonly + internal readonly int vc; // vowel count of the suffix // LUCENENET: marked readonly + internal readonly bool palatalizes; // true if we should fire palatalization rules. // LUCENENET: marked readonly internal Affix(string affix, int vc, bool palatalizes) { @@ -103,7 +103,7 @@ internal Affix(string affix, int vc, bool palatalizes) /// private static int Unpalatalize(char[] s, int len) // LUCENENET: CA1822: Mark members as static { - // we check the character removed: if its -u then + // we check the character removed: if its -u then // its 2,5, or 6 gen pl., and these two can only apply then. if (s[len] == 'u') { @@ -212,4 +212,4 @@ private static int NumVowels(char[] s, int len) // LUCENENET: CA1822: Mark membe return n; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs index 91e592c5eb..71e8d5f1d0 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs @@ -42,17 +42,17 @@ namespace Lucene.Net.Analysis.Miscellaneous /// assumed to be correct. /// "culture" - the culture to use to apply the capitalization rules. If not supplied or the string /// "invariant" is supplied, the invariant culture is used. - /// + /// /// /// <fieldType name="text_cptlztn" class="solr.TextField" positionIncrementGap="100"> /// <analyzer> /// <tokenizer class="solr.WhitespaceTokenizerFactory"/> /// <filter class="solr.CapitalizationFilterFactory" onlyFirstWord="true" /// keep="java solr lucene" keepIgnoreCase="false" - /// okPrefix="McK McD McA"/> + /// okPrefix="McK McD McA"/> /// </analyzer> /// </fieldType> - /// + /// /// @since solr 1.3 /// public class CapitalizationFilterFactory : TokenFilterFactory @@ -67,9 +67,9 @@ public class CapitalizationFilterFactory : TokenFilterFactory public const string FORCE_FIRST_LETTER = "forceFirstLetter"; public const string CULTURE = "culture"; // LUCENENET specific - internal CharArraySet keep; + internal readonly CharArraySet keep; // LUCENENET: marked readonly - internal ICollection okPrefix = Collections.EmptyList(); // for Example: McK + internal readonly ICollection okPrefix = Collections.EmptyList(); // for Example: McK // LUCENENET: marked readonly internal readonly int minWordLength; // don't modify capitalization for words shorter then this internal readonly int maxWordCount; @@ -119,4 +119,4 @@ public override TokenStream Create(TokenStream input) return new CapitalizationFilter(input, onlyFirstWord, keep, forceFirstLetter, okPrefix, minWordLength, maxWordCount, maxTokenLength, culture); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs index 439fc0f04a..d02e122973 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs @@ -55,7 +55,7 @@ public class WordDelimiterFilterFactory : TokenFilterFactory, IResourceLoaderAwa /// /// Creates a new - public WordDelimiterFilterFactory(IDictionary args) + public WordDelimiterFilterFactory(IDictionary args) : base(args) { AssureMatchVersion(); @@ -213,7 +213,7 @@ private static byte ParseType(string s) // LUCENENET: CA1822: Mark members as st } } - internal char[] @out = new char[256]; + internal readonly char[] @out = new char[256]; // LUCENENET: marked readonly private string ParseString(string s) { @@ -266,4 +266,4 @@ private string ParseString(string s) return new string(@out, 0, writePos); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs index 35172b8ba9..705bc7d88c 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs @@ -112,7 +112,7 @@ private static CharArrayDictionary LoadDefaultStemDict() // LUCENENET: A /// /// Contains words that should be indexed but not stemmed. /// - private CharArraySet excltable = CharArraySet.Empty; + private readonly CharArraySet excltable = CharArraySet.Empty; // LUCENENET: marked readonly private readonly StemmerOverrideFilter.StemmerOverrideMap stemdict; diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupFilterFactory.cs index d12b682b2c..22fa7210b5 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupFilterFactory.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.Analysis.Pattern */ /// - /// Factory for . + /// Factory for . /// /// <fieldType name="text_ptncapturegroup" class="solr.TextField" positionIncrementGap="100"> /// <analyzer> @@ -35,10 +35,10 @@ namespace Lucene.Net.Analysis.Pattern /// public class PatternCaptureGroupFilterFactory : TokenFilterFactory { - private Regex pattern; - private bool preserveOriginal = true; + private readonly Regex pattern; // LUCENENET: marked readonly + private readonly bool preserveOriginal /*= true*/; // LUCENENET: marked readonly, removed overwritten initializer - public PatternCaptureGroupFilterFactory(IDictionary args) + public PatternCaptureGroupFilterFactory(IDictionary args) : base(args) { pattern = GetPattern(args, "pattern"); @@ -50,4 +50,4 @@ public override TokenStream Create(TokenStream input) return new PatternCaptureGroupTokenFilter(input, preserveOriginal, pattern); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupTokenFilter.cs index 838aaef4b3..5ac17cd14a 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupTokenFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Pattern/PatternCaptureGroupTokenFilter.cs @@ -27,20 +27,20 @@ namespace Lucene.Net.Analysis.Pattern /// /// CaptureGroup uses .NET regexes to emit multiple tokens - one for each capture /// group in one or more patterns. - /// + /// /// /// For example, a pattern like: /// - /// + /// /// /// "(https?://([a-zA-Z\-_0-9.]+))" /// - /// + /// /// /// when matched against the string "http://www.foo.com/index" would return the /// tokens "https://www.foo.com" and "www.foo.com". /// - /// + /// /// /// If none of the patterns match, or if preserveOriginal is true, the original /// token will be preserved. @@ -55,9 +55,9 @@ namespace Lucene.Net.Analysis.Pattern /// /// /// - /// "([A-Z]{2,})", - /// "(?<![A-Z])([A-Z][a-z]+)", - /// "(?:^|\\b|(?<=[0-9_])|(?<=[A-Z]{2}))([a-z]+)", + /// "([A-Z]{2,})", + /// "(?<![A-Z])([A-Z][a-z]+)", + /// "(?:^|\\b|(?<=[0-9_])|(?<=[A-Z]{2}))([a-z]+)", /// "([0-9]+)" /// /// @@ -76,7 +76,7 @@ public sealed class PatternCaptureGroupTokenFilter : TokenFilter private readonly CharsRef spare = new CharsRef(); private readonly int[] groupCounts; private readonly bool preserveOriginal; - private int[] currentGroup; + private readonly int[] currentGroup; // LUCENENET: marked readonly private int currentMatcher; /// @@ -89,7 +89,7 @@ public sealed class PatternCaptureGroupTokenFilter : TokenFilter /// patterns matches /// /// an array of objects to match against each token - public PatternCaptureGroupTokenFilter(TokenStream input, bool preserveOriginal, params Regex[] patterns) + public PatternCaptureGroupTokenFilter(TokenStream input, bool preserveOriginal, params Regex[] patterns) : base(input) { this.preserveOriginal = preserveOriginal; @@ -118,7 +118,7 @@ private bool NextCapture() if (currentGroup[i] == -1) { if (matchers[i] is null) - matchers[i] = patterns[i].Match(new string(spare.Chars, spare.Offset, spare.Length)); + matchers[i] = patterns[i].Match(new string(spare.Chars, spare.Offset, spare.Length)); else matchers[i] = matchers[i].NextMatch(); currentGroup[i] = matchers[i].Success ? 1 : 0; @@ -160,7 +160,7 @@ public override bool IncrementToken() ClearAttributes(); RestoreState(state); int start = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index; - int end = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index + + int end = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index + matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Length; posAttr.PositionIncrement = 0; @@ -192,7 +192,7 @@ public override bool IncrementToken() else if (NextCapture()) { int start = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index; - int end = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index + + int end = matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Index + matchers[currentMatcher].Groups[currentGroup[currentMatcher]].Length; // if we start at 0 we can simply set the length and save the copy @@ -217,4 +217,4 @@ public override void Reset() currentMatcher = -1; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs index ceccf68f53..71b4be9bfc 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/NumericPayloadTokenFilter.cs @@ -27,13 +27,13 @@ namespace Lucene.Net.Analysis.Payloads /// public class NumericPayloadTokenFilter : TokenFilter { - private string typeMatch; - private BytesRef thePayload; + private readonly string typeMatch; // LUCENENET: marked readonly + private readonly BytesRef thePayload; // LUCENENET: marked readonly private readonly IPayloadAttribute payloadAtt; private readonly ITypeAttribute typeAtt; - public NumericPayloadTokenFilter(TokenStream input, float payload, string typeMatch) + public NumericPayloadTokenFilter(TokenStream input, float payload, string typeMatch) : base(input) { if (typeMatch is null) @@ -63,4 +63,4 @@ public override sealed bool IncrementToken() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs index 7a9940850a..d5fe31f062 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballAnalyzer.cs @@ -28,26 +28,26 @@ namespace Lucene.Net.Analysis.Snowball */ /// - /// Filters with , + /// Filters with , /// , and . - /// + /// /// Available stemmers are listed in org.tartarus.snowball.ext. The name of a /// stemmer is the part of the class name before "Stemmer", e.g., the stemmer in /// is named "English". - /// + /// /// NOTE: This class uses the same /// dependent settings as , with the following addition: /// /// As of 3.1, uses for Turkish language. /// /// - /// @deprecated (3.1) Use the language-specific analyzer in modules/analysis instead. - /// This analyzer will be removed in Lucene 5.0 + /// @deprecated (3.1) Use the language-specific analyzer in modules/analysis instead. + /// This analyzer will be removed in Lucene 5.0 [Obsolete("(3.1) Use the language-specific analyzer in modules/analysis instead. This analyzer will be removed in Lucene 5.0.")] public sealed class SnowballAnalyzer : Analyzer { - private string name; - private CharArraySet stopSet; + private readonly string name; // LUCENENET: marked readonly + private readonly CharArraySet stopSet; // LUCENENET: marked readonly private readonly LuceneVersion matchVersion; /// @@ -66,9 +66,9 @@ public SnowballAnalyzer(LuceneVersion matchVersion, string name, CharArraySet st } /// - /// Constructs a filtered by a + /// Constructs a filtered by a /// , a , a , - /// and a + /// and a /// protected internal override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { @@ -96,4 +96,4 @@ protected internal override TokenStreamComponents CreateComponents(string fieldN return new TokenStreamComponents(tokenizer, result); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymMap.cs index c319c7d79c..cc0a0de10b 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymMap.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymMap.cs @@ -91,7 +91,7 @@ internal class MapEntry { internal bool includeOrig; // we could sort for better sharing ultimately, but it could confuse people - internal JCG.List ords = new JCG.List(); + internal readonly JCG.List ords = new JCG.List(); // LUCENENET: marked readonly } /// diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs index 79a40c1b74..5cff821f6f 100644 --- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs +++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs @@ -46,7 +46,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm /// public class PhoneticEngine { - internal Regex WHITESPACE = new Regex("\\s+", RegexOptions.Compiled); + internal static readonly Regex WHITESPACE = new Regex("\\s+", RegexOptions.Compiled); // LUCENENET: marked static readonly /// /// Utility for manipulating a set of phonemes as they are being built up. Not intended for use outside diff --git a/src/Lucene.Net.Analysis.Phonetic/PhoneticFilterFactory.cs b/src/Lucene.Net.Analysis.Phonetic/PhoneticFilterFactory.cs index 0110dd7f41..dfa27d88b3 100644 --- a/src/Lucene.Net.Analysis.Phonetic/PhoneticFilterFactory.cs +++ b/src/Lucene.Net.Analysis.Phonetic/PhoneticFilterFactory.cs @@ -55,7 +55,7 @@ namespace Lucene.Net.Analysis.Phonetic /// /// /// - /// + /// /// /// <fieldType name="text_phonetic" class="solr.TextField" positionIncrementGap="100"> /// <analyzer> @@ -87,7 +87,7 @@ public class PhoneticFilterFactory : TokenFilterFactory, IResourceLoaderAware { "ColognePhonetic".ToUpperInvariant(), typeof(ColognePhonetic) }, }; - internal bool inject; //accessed by the test + internal readonly bool inject; //accessed by the test // LUCENENET: marked readonly private readonly string name; private readonly int? maxCodeLength; private Type clazz = null; diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs index 22b083f558..0d1867c9f3 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Row.cs @@ -65,7 +65,7 @@ namespace Egothor.Stemmer /// public class Row { - internal IDictionary cells = new JCG.SortedDictionary(); + internal readonly IDictionary cells = new JCG.SortedDictionary(); // LUCENENET: marked readonly internal int uniformCnt = 0; internal int uniformSkip = 0; diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs index 5ebe445fc7..34262d604e 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Trie.cs @@ -71,9 +71,9 @@ namespace Egothor.Stemmer /// public class Trie { - internal IList rows = new JCG.List(); - internal IList cmds = new JCG.List(); - internal int root; + internal readonly IList rows = new JCG.List(); // LUCENENET: marked readonly + internal readonly IList cmds = new JCG.List(); // LUCENENET: marked readonly + internal readonly int root; // LUCENENET: marked readonly internal bool forward = false; diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/DirContentSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/DirContentSource.cs index 06bb70fb4a..9024e59f87 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/DirContentSource.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/DirContentSource.cs @@ -82,7 +82,7 @@ which reverses again */ internal int count = 0; - internal Stack stack = new Stack(); + internal readonly Stack stack = new Stack(); // LUCENENET: marked readonly /* this seems silly ... there must be a better way ... not that this is good, but can it matter? */ diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/DocMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/DocMaker.cs index 2a10caefad..7fe0381f06 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/DocMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/DocMaker.cs @@ -41,7 +41,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds /// doc.body.tokenizedspecifies whether the body field should be tokenized (default = doc.tokenized). /// doc.tokenized.normsspecifies whether norms should be stored in the index or not. (default false). /// doc.body.tokenized.norms - /// specifies whether norms should be stored in the index for the body field. + /// specifies whether norms should be stored in the index for the body field. /// This can be set to true, while doc.tokenized.norms is set to false, to allow norms storing just /// for the body field. (default true). /// @@ -80,7 +80,7 @@ protected class DocState private readonly IDictionary numericFields; private readonly bool reuseFields; internal readonly Document doc; - internal DocData docData = new DocData(); + internal readonly DocData docData = new DocData(); // LUCENENET: marked readonly public DocState(bool reuseFields, FieldType ft, FieldType bodyFt) { @@ -275,7 +275,7 @@ private Document CreateDocument(DocData docData, int size, int cnt) if (date is null) { // just set to right now - date = DateTime.Now; + date = DateTime.Now; } Field dateField = ds.GetNumericField(DATE_MSEC_FIELD, NumericType.INT64); diff --git a/src/Lucene.Net.Benchmark/ByTask/Stats/TaskStats.cs b/src/Lucene.Net.Benchmark/ByTask/Stats/TaskStats.cs index 5c8014c0eb..2ee81876e5 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Stats/TaskStats.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Stats/TaskStats.cs @@ -24,9 +24,9 @@ namespace Lucene.Net.Benchmarks.ByTask.Stats */ /// - /// Statistics for a task run. + /// Statistics for a task run. /// - /// The same task can run more than once, but, if that task records statistics, + /// The same task can run more than once, but, if that task records statistics, /// each run would create its own TaskStats. /// public class TaskStats // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation @@ -38,7 +38,7 @@ public class TaskStats // LUCENENET specific: Not implementing ICloneable per Mi private int round; /// Task start time. - private long start; + private readonly long start; // LUCENENET: marked readonly /// Task elapsed time. elapsed >= 0 indicates run completion! private long elapsed = -1; @@ -58,13 +58,13 @@ public class TaskStats // LUCENENET specific: Not implementing ICloneable per Mi /// /// Number of work items done by this task. /// For indexing that can be number of docs added. - /// For warming that can be number of scanned items, etc. + /// For warming that can be number of scanned items, etc. /// For repeating tasks, this is a sum over repetitions. /// private int count; /// - /// Number of similar tasks aggregated into this record. + /// Number of similar tasks aggregated into this record. /// Used when summing up on few runs/instances of similar tasks. /// private int numRuns = 1; @@ -115,7 +115,7 @@ public virtual void SetCountsByTime(int[] counts, long msecStep) [WritableArray] public virtual int[] GetCountsByTime() { - return countsByTime; + return countsByTime; } public virtual long CountsByTimeStepMSec => countsByTimeStepMSec; @@ -168,7 +168,7 @@ public virtual void Add(TaskStats stat2) count += stat2.Count; if (round != stat2.round) { - round = -1; // no meaning if aggregating tasks of different round. + round = -1; // no meaning if aggregating tasks of different round. } if (countsByTime != null && stat2.countsByTime != null) diff --git a/src/Lucene.Net.Benchmark/Quality/Trec/TrecJudge.cs b/src/Lucene.Net.Benchmark/Quality/Trec/TrecJudge.cs index 4bcffa8a7b..25c9a6f15e 100644 --- a/src/Lucene.Net.Benchmark/Quality/Trec/TrecJudge.cs +++ b/src/Lucene.Net.Benchmark/Quality/Trec/TrecJudge.cs @@ -106,7 +106,7 @@ public virtual bool IsRelevant(string docName, QualityQuery query) /// private class QRelJudgement { - internal string queryID; + internal readonly string queryID; // LUCENENET: marked readonly private readonly IDictionary relevantDocs; // LUCENENET: marked readonly internal QRelJudgement(string queryID) diff --git a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs index 01ebc8a5d3..98bd9ec694 100644 --- a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs +++ b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs @@ -146,8 +146,8 @@ private string[] BestTerms(string field, int numTerms) private class TermDf { - internal string word; - internal int df; + internal readonly string word; // LUCENENET: marked readonly + internal readonly int df; // LUCENENET: marked readonly internal TermDf(string word, int freq) { this.word = word; diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs index 44745aa482..b907ff2d77 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs @@ -254,7 +254,7 @@ internal abstract class BaseTermsEnum : TermsEnum /// Current term stats + undecoded metadata (long[] & byte[]). internal FSTTermOutputs.TermData meta; - internal ByteArrayDataInput bytesReader; + internal readonly ByteArrayDataInput bytesReader; // LUCENENET: marked readonly /// /// Decodes metadata into customized term state. @@ -860,4 +860,4 @@ public override void CheckIntegrity() postingsReader.CheckIntegrity(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs index a86b8312c9..91da8e843d 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs @@ -138,7 +138,7 @@ public PostingsWriter(MemoryPostingsFormat.TermsWriter outerInstance) // NOTE: not private so we don't pay access check at runtime: internal int docCount; - internal RAMOutputStream buffer = new RAMOutputStream(); + internal readonly RAMOutputStream buffer = new RAMOutputStream(); // LUCENENET: marked readonly private int lastOffsetLength; private int lastOffset; diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs index 5a948e2268..2f15d3f26f 100644 --- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs +++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs @@ -52,7 +52,7 @@ private class FakeScorer : Scorer { internal float score; internal int doc = -1; - internal int freq = 1; + internal const int freq = 1; // LUCENENET: marked const public FakeScorer() : base(null) diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs index fa42f72ec0..44ec1ab318 100644 --- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs +++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs @@ -1127,7 +1127,7 @@ public int[] GetMap() /// public sealed class DiskOrdinalMap : IOrdinalMap { - internal string tmpfile; + internal readonly string tmpfile; // LUCENENET: marked readonly internal OutputStreamDataOutput @out; /// diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs index 6459db7808..07fc91f4ec 100644 --- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs +++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CharBlockArray.cs @@ -97,9 +97,9 @@ public Block(Stream reader) } } - internal IList blocks; + internal readonly IList blocks; // LUCENENET: marked readonly internal Block current; - internal int blockSize; + internal readonly int blockSize; // LUCENENET: marked readonly internal int length; public CharBlockArray() diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs index c466b89a7a..1442e1f098 100644 --- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs +++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs @@ -25,7 +25,7 @@ namespace Lucene.Net.Facet.Taxonomy.WriterCache /// /// HashMap to store colliding labels. See for /// details. - /// + /// /// @lucene.experimental /// public class CollisionMap @@ -37,10 +37,10 @@ public class CollisionMap internal class Entry { - internal int offset; - internal int cid; + internal readonly int offset; // LUCENENET: marked readonly + internal readonly int cid; // LUCENENET: marked readonly internal Entry next; - internal int hash; + internal readonly int hash; // LUCENENET: marked readonly internal Entry(int offset, int cid, int h, Entry e) { @@ -81,7 +81,7 @@ private CollisionMap(int initialCapacity, float loadFactor, CharBlockArray label public virtual int Count => this.size; /// - /// How many slots are allocated. + /// How many slots are allocated. /// public virtual int Capacity => this.capacity; @@ -115,8 +115,8 @@ private void Grow() } /// - /// Return the mapping, or - /// if the label isn't recognized. + /// Return the mapping, or + /// if the label isn't recognized. /// public virtual int Get(FacetLabel label, int hash) { @@ -136,7 +136,7 @@ public virtual int Get(FacetLabel label, int hash) } /// - /// Add another mapping. + /// Add another mapping. /// public virtual int AddLabel(FacetLabel label, int hash, int cid) { @@ -183,7 +183,7 @@ private void AddEntry(int offset, int cid, int hash, int bucketIndex) } /// - /// Returns index for hash code h. + /// Returns index for hash code h. /// internal static int IndexFor(int h, int length) { @@ -217,7 +217,7 @@ private sealed class EntryEnumerator : IEnumerator // LUCENENET: Marked s { internal Entry next; // next entry to return internal int index; // current slot - internal Entry[] ents; + internal readonly Entry[] ents; // LUCENENET: marked readonly internal EntryEnumerator(Entry[] entries, int size) { @@ -287,4 +287,4 @@ public void Reset() object IEnumerator.Current => Current; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs index fb4272b7cd..02f8c80d6c 100644 --- a/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs +++ b/src/Lucene.Net.Facet/Taxonomy/WriterCache/CompactLabelToOrdinal.cs @@ -484,10 +484,10 @@ internal virtual void Flush(Stream stream) private sealed class HashArray { - internal int[] offsets; - internal int[] cids; + internal readonly int[] offsets; // LUCENENET: marked readonly + internal readonly int[] cids; // LUCENENET: marked readonly - internal int capacity; + internal readonly int capacity; // LUCENENET: marked readonly internal HashArray(int c) { diff --git a/src/Lucene.Net.Grouping/Term/TermAllGroupHeadsCollector.cs b/src/Lucene.Net.Grouping/Term/TermAllGroupHeadsCollector.cs index f0580225d2..e84247af88 100644 --- a/src/Lucene.Net.Grouping/Term/TermAllGroupHeadsCollector.cs +++ b/src/Lucene.Net.Grouping/Term/TermAllGroupHeadsCollector.cs @@ -26,7 +26,7 @@ namespace Lucene.Net.Search.Grouping.Terms /// A base implementation of for retrieving the most relevant groups when grouping /// on a string based group field. More specifically this all concrete implementations of this base implementation /// use . - /// + /// /// @lucene.experimental /// /// @@ -382,9 +382,9 @@ internal class GroupHead : AbstractAllGroupHeadsCollector_GroupHead /*AbstractAl public BytesRef GroupValue => groupValue; private readonly BytesRef groupValue; - internal BytesRef[] sortValues; - internal int[] sortOrds; - internal float[] scores; + internal readonly BytesRef[] sortValues; // LUCENENET: marked readonly + internal readonly int[] sortOrds; // LUCENENET: marked readonly + internal readonly float[] scores; // LUCENENET: marked readonly internal GroupHead(OrdScoreAllGroupHeadsCollector outerInstance, int doc, BytesRef groupValue) : base(doc + outerInstance.readerContext.DocBase) @@ -596,8 +596,8 @@ internal class GroupHead : AbstractAllGroupHeadsCollector_GroupHead /* AbstractA // need to reference the generic closing type BytesRef. public BytesRef GroupValue => groupValue; private readonly BytesRef groupValue; - internal BytesRef[] sortValues; - internal int[] sortOrds; + internal readonly BytesRef[] sortValues; // LUCENENET: marked readonly + internal readonly int[] sortOrds; // LUCENENET: marked readonly internal GroupHead(OrdAllGroupHeadsCollector outerInstance, int doc, BytesRef groupValue) : base(doc + outerInstance.readerContext.DocBase) @@ -758,7 +758,7 @@ internal class GroupHead : AbstractAllGroupHeadsCollector_GroupHead // need to reference the generic closing type BytesRef. public BytesRef GroupValue => groupValue; private readonly BytesRef groupValue; - internal float[] scores; + internal readonly float[] scores; // LUCENENET: marked readonly internal GroupHead(ScoreAllGroupHeadsCollector outerInstance, int doc, BytesRef groupValue) : base(doc + outerInstance.readerContext.DocBase) diff --git a/src/Lucene.Net.Highlighter/Highlight/SimpleHTMLFormatter.cs b/src/Lucene.Net.Highlighter/Highlight/SimpleHTMLFormatter.cs index a3bba74f05..ae99fc520d 100644 --- a/src/Lucene.Net.Highlighter/Highlight/SimpleHTMLFormatter.cs +++ b/src/Lucene.Net.Highlighter/Highlight/SimpleHTMLFormatter.cs @@ -26,8 +26,8 @@ public class SimpleHTMLFormatter : IFormatter private const string DEFAULT_PRE_TAG = ""; private const string DEFAULT_POST_TAG = ""; - internal string preTag; - internal string postTag; + internal readonly string preTag; // LUCENENET: marked readonly + internal readonly string postTag; // LUCENENET: marked readonly public SimpleHTMLFormatter(string preTag, string postTag) { @@ -35,7 +35,7 @@ public SimpleHTMLFormatter(string preTag, string postTag) this.postTag = postTag; } - /// + /// /// Default constructor uses HTML: <B> tags to markup terms /// public SimpleHTMLFormatter() : this(DEFAULT_PRE_TAG, DEFAULT_POST_TAG) { } @@ -52,7 +52,7 @@ public virtual string HighlightTerm(string originalText, TokenGroup tokenGroup) // Allocate StringBuilder with the right number of characters from the // beginning, to avoid char[] allocations in the middle of appends. - StringBuilder returnBuffer = new StringBuilder(preTag.Length + originalText.Length + postTag.Length); + StringBuilder returnBuffer = new StringBuilder(preTag.Length + originalText.Length + postTag.Length); returnBuffer.Append(preTag); returnBuffer.Append(originalText); returnBuffer.Append(postTag); diff --git a/src/Lucene.Net.Highlighter/Highlight/TokenGroup.cs b/src/Lucene.Net.Highlighter/Highlight/TokenGroup.cs index aa3aa82d92..0d7b21cda9 100644 --- a/src/Lucene.Net.Highlighter/Highlight/TokenGroup.cs +++ b/src/Lucene.Net.Highlighter/Highlight/TokenGroup.cs @@ -30,8 +30,8 @@ public class TokenGroup { private const int MAX_NUM_TOKENS_PER_GROUP = 50; - internal Token[] tokens = new Token[MAX_NUM_TOKENS_PER_GROUP]; - internal float[] scores = new float[MAX_NUM_TOKENS_PER_GROUP]; + internal readonly Token[] tokens = new Token[MAX_NUM_TOKENS_PER_GROUP]; // LUCENENET: marked readonly + internal readonly float[] scores = new float[MAX_NUM_TOKENS_PER_GROUP]; // LUCENENET: marked readonly internal int MatchStartOffset { get; set; } internal int MatchEndOffset { get; set; } diff --git a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs index 24c2154690..fcb16ef1f8 100644 --- a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs +++ b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs @@ -57,12 +57,12 @@ public int Compare(Token t1, Token t2) internal sealed class StoredTokenStream : TokenStream { - internal Token[] tokens; + internal readonly Token[] tokens; // LUCENENET: marked readonly internal int currentToken = 0; - internal ICharTermAttribute termAtt; - internal IOffsetAttribute offsetAtt; - internal IPositionIncrementAttribute posincAtt; - internal IPayloadAttribute payloadAtt; + internal readonly ICharTermAttribute termAtt; // LUCENENET: marked readonly + internal readonly IOffsetAttribute offsetAtt; // LUCENENET: marked readonly + internal readonly IPositionIncrementAttribute posincAtt; // LUCENENET: marked readonly + internal readonly IPayloadAttribute payloadAtt; // LUCENENET: marked readonly internal StoredTokenStream(Token[] tokens) { diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs index da517f697c..e796eff56c 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs @@ -804,9 +804,9 @@ protected virtual Passage[] GetEmptyHighlight(string fieldName, BreakIterator bi internal class OffsetsEnum : IComparable { - internal DocsAndPositionsEnum dp; + internal readonly DocsAndPositionsEnum dp; // LUCENENET: marked readonly internal int pos; - internal int id; + internal readonly int id; // LUCENENET: marked readonly internal OffsetsEnum(DocsAndPositionsEnum dp, int id) { diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs index 122ecd8dfe..c2d47016ca 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs @@ -35,7 +35,7 @@ public class FieldPhraseList /// /// List of non-overlapping objects. /// - internal IList phraseList = new JCG.List(); + internal readonly IList phraseList = new JCG.List(); // LUCENENET: marked readonly /// /// create a that has no limit on the number of phrases to analyze diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs index 624b3f11b7..b585197263 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs @@ -34,11 +34,11 @@ public class FieldQuery // fieldMatch==true, Map // fieldMatch==false, Map - internal IDictionary rootMaps = new JCG.Dictionary(); + internal readonly IDictionary rootMaps = new JCG.Dictionary(); // LUCENENET: marked readonly // fieldMatch==true, Map // fieldMatch==false, Map - internal IDictionary> termSetMap = new JCG.Dictionary>(); + internal readonly IDictionary> termSetMap = new JCG.Dictionary>(); // LUCENENET: marked readonly internal int termOrPhraseNumber; // used for colored tag support @@ -428,8 +428,8 @@ public class QueryPhraseMap internal int slop; // valid if terminal == true and phraseHighlight == true internal float boost; // valid if terminal == true internal int termOrPhraseNumber; // valid if terminal == true - internal FieldQuery fieldQuery; - internal IDictionary subMap = new Dictionary(); + internal readonly FieldQuery fieldQuery; // LUCENENET: marked readonly + internal readonly IDictionary subMap = new Dictionary(); // LUCENENET: marked readonly public QueryPhraseMap(FieldQuery fieldQuery) { diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldTermStack.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldTermStack.cs index a8a0e3b3b3..fa14efec10 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldTermStack.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldTermStack.cs @@ -33,7 +33,7 @@ namespace Lucene.Net.Search.VectorHighlight public class FieldTermStack { private readonly string fieldName; - internal IList termList = new JCG.List(); + internal readonly IList termList = new JCG.List(); // LUCENENET: marked readonly //public static void main( string[] args ) throws Exception { // Analyzer analyzer = new WhitespaceAnalyzer(Version.LUCENE_CURRENT); diff --git a/src/Lucene.Net.Memory/MemoryIndex.Info.cs b/src/Lucene.Net.Memory/MemoryIndex.Info.cs index 354124b683..feb4ecb812 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.Info.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.Info.cs @@ -36,36 +36,36 @@ private sealed class Info internal readonly SliceByteStartArray sliceArray; /// - /// Terms sorted ascending by term text; computed on demand + /// Terms sorted ascending by term text; computed on demand /// internal int[] sortedTerms; /// - /// Number of added tokens for this field + /// Number of added tokens for this field /// internal readonly int numTokens; /// - /// Number of overlapping tokens for this field + /// Number of overlapping tokens for this field /// internal readonly int numOverlapTokens; /// - /// Boost factor for hits for this field + /// Boost factor for hits for this field /// internal readonly float boost; internal readonly long sumTotalTermFreq; /// - /// the last position encountered in this field for multi field support + /// the last position encountered in this field for multi field support /// - internal int lastPosition; + internal readonly int lastPosition; // LUCENENET: marked readonly /// - /// the last offset encountered in this field for multi field support + /// the last offset encountered in this field for multi field support /// - internal int lastOffset; + internal readonly int lastOffset; // LUCENENET: marked readonly public Info(BytesRefHash terms, SliceByteStartArray sliceArray, int numTokens, int numOverlapTokens, float boost, int lastPosition, int lastOffset, long sumTotalTermFreq) { diff --git a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs index d1f350a4f8..18bd04336a 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs @@ -409,7 +409,7 @@ private class MemoryDocsAndPositionsEnum : DocsAndPositionsEnum internal bool hasNext; internal IBits liveDocs; internal int doc = -1; - internal Int32BlockPool.SliceReader sliceReader; + internal readonly Int32BlockPool.SliceReader sliceReader; // LUCENENET: marked readonly internal int freq; internal int startOffset; internal int endOffset; diff --git a/src/Lucene.Net.Misc/Document/LazyDocument.cs b/src/Lucene.Net.Misc/Document/LazyDocument.cs index 5537216c84..b60e771272 100644 --- a/src/Lucene.Net.Misc/Document/LazyDocument.cs +++ b/src/Lucene.Net.Misc/Document/LazyDocument.cs @@ -150,8 +150,8 @@ public class LazyField : IIndexableField, IFormattable { private readonly LazyDocument outerInstance; - internal string name; - internal int fieldNum; + internal readonly string name; // LUCENENET: marked readonly + internal readonly int fieldNum; // LUCENENET: marked readonly internal volatile IIndexableField realValue = null; internal LazyField(LazyDocument outerInstance, string name, int fieldNum) diff --git a/src/Lucene.Net.Misc/Index/IndexSplitter.cs b/src/Lucene.Net.Misc/Index/IndexSplitter.cs index 5a842805d5..f3a06c8a39 100644 --- a/src/Lucene.Net.Misc/Index/IndexSplitter.cs +++ b/src/Lucene.Net.Misc/Index/IndexSplitter.cs @@ -55,9 +55,9 @@ public class IndexSplitter { public SegmentInfos Infos { get; set; } - internal FSDirectory fsDir; + internal readonly FSDirectory fsDir; // LUCENENET: marked readonly - internal DirectoryInfo dir; + internal readonly DirectoryInfo dir; // LUCENENET: marked readonly /// /// LUCENENET specific: In the Java implementation, this Main method diff --git a/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs b/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs index 7c02de3fd3..4ae016b04c 100644 --- a/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs +++ b/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs @@ -21,9 +21,9 @@ namespace Lucene.Net.QueryParsers.Classic * See the License for the specific language governing permissions and * limitations under the License. */ - + /// - /// An efficient implementation of JavaCC's interface. + /// An efficient implementation of JavaCC's interface. /// /// Note that /// this does not do line-number counting, but instead keeps track of the @@ -33,34 +33,34 @@ namespace Lucene.Net.QueryParsers.Classic public sealed class FastCharStream : ICharStream { internal char[] buffer = null; - + internal int bufferLength = 0; // end of valid chars internal int bufferPosition = 0; // next char to read - + internal int tokenStart = 0; // offset in buffer internal int bufferStart = 0; // position in file of buffer - - internal TextReader input; // source of chars + + internal readonly TextReader input; // source of chars // LUCENENET: marked readonly /// - /// Constructs from a . + /// Constructs from a . /// public FastCharStream(TextReader r) { input = r; } - + public char ReadChar() { if (bufferPosition >= bufferLength) Refill(); return buffer[bufferPosition++]; } - + private void Refill() { int newPosition = bufferLength - tokenStart; - + if (tokenStart == 0) { // token won't fit in buffer @@ -82,25 +82,25 @@ private void Refill() // shift token to front Arrays.Copy(buffer, tokenStart, buffer, 0, newPosition); } - + bufferLength = newPosition; // update state bufferPosition = newPosition; bufferStart += tokenStart; tokenStart = 0; - + int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition); if (charsRead <= 0) throw new IOException("read past eof"); else bufferLength += charsRead; } - + public char BeginToken() { tokenStart = bufferPosition; return ReadChar(); } - + public void BackUp(int amount) { bufferPosition -= amount; @@ -114,7 +114,7 @@ public char[] GetSuffix(int len) Arrays.Copy(buffer, bufferPosition - len, value, 0, len); return value; } - + public void Done() { try @@ -139,4 +139,4 @@ public void Done() public int BeginLine => 1; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs index 79d0032bd0..19a89ae908 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs @@ -1231,7 +1231,7 @@ protected internal virtual Token JjFillToken() } internal int curLexState = 2; - internal int defaultLexState = 2; + internal const int defaultLexState = 2; // LUCENENET: marked const internal int jjnewStateCnt; internal uint jjround; internal int jjmatchedPos; diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs index 420f7674e0..11d1819f74 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs @@ -857,7 +857,7 @@ protected Token JjFillToken() } internal int curLexState = 2; - internal int defaultLexState = 2; + internal const int defaultLexState = 2; // LUCENENET: marked const internal int jjnewStateCnt; internal uint jjround; internal int jjmatchedPos; diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs b/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs index fbf9b8424a..77ef1f4e1b 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.QueryParsers.Surround.Parser */ /// - /// An efficient implementation of JavaCC's interface. + /// An efficient implementation of JavaCC's interface. /// /// Note that /// this does not do line-number counting, but instead keeps track of the @@ -40,10 +40,10 @@ public sealed class FastCharStream : ICharStream internal int tokenStart = 0; // offset in buffer internal int bufferStart = 0; // position in file of buffer - internal System.IO.TextReader input; // source of chars + internal readonly System.IO.TextReader input; // source of chars // LUCENENET: marked readonly /// - /// Constructs from a . + /// Constructs from a . /// public FastCharStream(System.IO.TextReader r) { @@ -139,4 +139,4 @@ public void Done() public int BeginLine => 1; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs index c4999c4bc8..67029431a8 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs @@ -643,7 +643,7 @@ protected Token JjFillToken() } internal int curLexState = 1; - internal int defaultLexState = 1; + internal const int defaultLexState = 1; // LUCENENET: marked const internal int jjnewStateCnt; internal uint jjround; internal int jjmatchedPos; diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs index 9fd5d3ceac..5a334028f3 100644 --- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs @@ -122,10 +122,10 @@ public FuzzyLikeThisQuery(int maxNumTerms, Analyzer analyzer) internal class FieldVals { - internal string queryString; - internal string fieldName; - internal float minSimilarity; - internal int prefixLength; + internal readonly string queryString; // LUCENENET: marked readonly + internal readonly string fieldName; // LUCENENET: marked readonly + internal readonly float minSimilarity; // LUCENENET: marked readonly + internal readonly int prefixLength; // LUCENENET: marked readonly public FieldVals(string name, float similarity, int length, string queryString) { fieldName = name; diff --git a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs index 34b8fd4445..e9c67661be 100644 --- a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs +++ b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs @@ -80,7 +80,7 @@ public ContainsVisitor(ContainsPrefixTreeFilter outerInstance, AtomicReaderConte { } - internal BytesRef termBytes = new BytesRef(); + internal readonly BytesRef termBytes = new BytesRef(); // LUCENENET: marked readonly internal Cell? nextCell;//see getLeafDocs /// This is the primary algorithm; recursive. Returns null if finds none. diff --git a/src/Lucene.Net.Suggest/Spell/HighFrequencyDictionary.cs b/src/Lucene.Net.Suggest/Spell/HighFrequencyDictionary.cs index ad056d3391..88d9e05444 100644 --- a/src/Lucene.Net.Suggest/Spell/HighFrequencyDictionary.cs +++ b/src/Lucene.Net.Suggest/Spell/HighFrequencyDictionary.cs @@ -27,10 +27,10 @@ namespace Lucene.Net.Search.Spell /// HighFrequencyDictionary: terms taken from the given field /// of a Lucene index, which appear in a number of documents /// above a given threshold. - /// + /// /// Threshold is a value in [0..1] representing the minimum /// number of documents (of the total) where a term should appear. - /// + /// /// Based on . /// public class HighFrequencyDictionary : IDictionary @@ -63,7 +63,7 @@ internal sealed class HighFrequencyEnumerator : IInputEnumerator { internal readonly BytesRef spare = new BytesRef(); internal readonly TermsEnum termsEnum; - internal int minNumDocs; + internal readonly int minNumDocs; // LUCENENET: marked readonly internal long freq; private BytesRef current; @@ -133,4 +133,4 @@ public IComparer Comparer public bool HasContexts => false; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Spell/TermFreqIterator.cs b/src/Lucene.Net.Suggest/Spell/TermFreqIterator.cs index f2e586ab7d..93c83b39fd 100644 --- a/src/Lucene.Net.Suggest/Spell/TermFreqIterator.cs +++ b/src/Lucene.Net.Suggest/Spell/TermFreqIterator.cs @@ -39,10 +39,10 @@ public interface ITermFreqEnumerator : IBytesRefEnumerator /// public class TermFreqEnumeratorWrapper : ITermFreqEnumerator { - internal IBytesRefEnumerator wrapped; + internal readonly IBytesRefEnumerator wrapped; // LUCENENET: marked readonly /// - /// Creates a new wrapper, wrapping the specified iterator and + /// Creates a new wrapper, wrapping the specified iterator and /// specifying a weight value of 1 for all terms. /// public TermFreqEnumeratorWrapper(IBytesRefEnumerator wrapped) @@ -58,4 +58,4 @@ public TermFreqEnumeratorWrapper(IBytesRefEnumerator wrapped) public virtual IComparer Comparer => wrapped.Comparer; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterIndexWriterConfigFactory.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterIndexWriterConfigFactory.cs index f541e79ea3..1d17dd4b86 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterIndexWriterConfigFactory.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterIndexWriterConfigFactory.cs @@ -34,14 +34,14 @@ public interface IAnalyzingInfixSuggesterIndexWriterConfigFactory { IndexWriterConfig Get(LuceneVersion matchVersion, Analyzer indexAnalyzer, OpenMode openMode); } - + /// /// Default factory for . /// /// public class AnalyzingInfixSuggesterIndexWriterConfigFactory : IAnalyzingInfixSuggesterIndexWriterConfigFactory { - private Sort sort; + private readonly Sort sort; // LUCENENET: marked readonly /// /// Creates a new config factory that uses the given in the sorting merge policy @@ -50,10 +50,10 @@ public AnalyzingInfixSuggesterIndexWriterConfigFactory(Sort sort) { this.sort = sort; } - + /// /// Override this to customize index settings, e.g. which - /// codec to use. + /// codec to use. /// public virtual IndexWriterConfig Get(LuceneVersion matchVersion, Analyzer indexAnalyzer, OpenMode openMode) { @@ -71,4 +71,4 @@ public virtual IndexWriterConfig Get(LuceneVersion matchVersion, Analyzer indexA return iwc; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs index 4b453c6614..72073b1d42 100644 --- a/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs +++ b/src/Lucene.Net.Suggest/Suggest/FileDictionary.cs @@ -28,7 +28,7 @@ namespace Lucene.Net.Search.Suggest /// /// Dictionary represented by a text file. - /// + /// /// Format allowed: 1 entry per line: /// An entry can be: /// @@ -38,12 +38,12 @@ namespace Lucene.Net.Search.Suggest /// /// where the default is (a tab) /// - /// NOTE: + /// NOTE: /// /// In order to have payload enabled, the first entry has to have a payload /// If the weight for an entry is not specified then a value of 1 is used /// A payload cannot be specified without having the weight specified for an entry - /// If the payload for an entry is not specified (assuming payload is enabled) + /// If the payload for an entry is not specified (assuming payload is enabled) /// then an empty payload is returned /// An entry cannot have more than two s /// @@ -67,7 +67,7 @@ public class FileDictionary : IDictionary /// /// Creates a dictionary based on an inputstream. - /// Using as the + /// Using as the /// field seperator in a line. /// /// NOTE: content is treated as UTF-8 @@ -80,7 +80,7 @@ public FileDictionary(Stream dictFile) /// /// Creates a dictionary based on a reader. - /// Using as the + /// Using as the /// field seperator in a line. /// public FileDictionary(TextReader reader) @@ -89,7 +89,7 @@ public FileDictionary(TextReader reader) } /// - /// Creates a dictionary based on a reader. + /// Creates a dictionary based on a reader. /// Using to seperate out the /// fields in a line. /// @@ -133,7 +133,7 @@ internal sealed class FileEnumerator : IInputEnumerator internal readonly BytesRef spare = new BytesRef(); internal BytesRef curPayload = new BytesRef(); internal bool isFirstLine = true; - internal bool hasPayloads = false; + internal readonly bool hasPayloads /*= false*/; // LUCENENET: marked readonly private BytesRef current; internal FileEnumerator(FileDictionary outerInstance) @@ -259,4 +259,4 @@ internal void ReadWeight(string weight) public bool HasContexts => false; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs b/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs index b36a0fa019..d9c2e5207b 100644 --- a/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs +++ b/src/Lucene.Net.Suggest/Suggest/Tst/TSTLookup.cs @@ -25,14 +25,14 @@ namespace Lucene.Net.Search.Suggest.Tst */ /// - /// Suggest implementation based on a + /// Suggest implementation based on a /// Ternary Search Tree /// /// public class TSTLookup : Lookup { internal TernaryTreeNode root = new TernaryTreeNode(); - internal TSTAutocomplete autocomplete = new TSTAutocomplete(); + internal readonly TSTAutocomplete autocomplete = new TSTAutocomplete(); // LUCENENET: marked readonly /// /// Number of entries the lookup was built with @@ -136,7 +136,7 @@ private static bool CharSeqEquals(string left, string right) } return true; } - + public override IList DoLookup(string key, IEnumerable contexts, bool onlyMorePopular, int num) { if (contexts != null) @@ -307,4 +307,4 @@ public override long GetSizeInBytes() public override long Count => count; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Analysis/MockCharFilter.cs b/src/Lucene.Net.TestFramework/Analysis/MockCharFilter.cs index 442ff02053..3092bef73b 100644 --- a/src/Lucene.Net.TestFramework/Analysis/MockCharFilter.cs +++ b/src/Lucene.Net.TestFramework/Analysis/MockCharFilter.cs @@ -121,6 +121,6 @@ protected virtual void AddOffCorrectMap(int off, int cumulativeDiff) corrections[off] = cumulativeDiff; } - internal JCG.SortedDictionary corrections = new JCG.SortedDictionary(); + internal readonly JCG.SortedDictionary corrections = new JCG.SortedDictionary(); // LUCENENET: marked readonly } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs index 320c16a6af..412a90887a 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs @@ -77,7 +77,7 @@ public PreFlexRWFieldsWriter(SegmentWriteState state) } } - skipListWriter = new PreFlexRWSkipListWriter(termsOut.skipInterval, termsOut.maxSkipLevels, totalNumDocs, freqOut, proxOut); + skipListWriter = new PreFlexRWSkipListWriter(TermInfosWriter.skipInterval, TermInfosWriter.maxSkipLevels, totalNumDocs, freqOut, proxOut); //System.out.println("\nw start seg=" + segment); } @@ -154,7 +154,7 @@ public override void StartDoc(int docID, int termDocFreq) throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " )"); } - if ((++df % outerInstance.outerInstance.termsOut.skipInterval) == 0) + if ((++df % TermInfosWriter.skipInterval) == 0) { outerInstance.outerInstance.skipListWriter.SetSkipData(lastDocID, outerInstance.storePayloads, lastPayloadLength); outerInstance.outerInstance.skipListWriter.BufferSkip(df); diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/TermInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/TermInfosWriter.cs index ec518d0958..51cb676081 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/TermInfosWriter.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/TermInfosWriter.cs @@ -72,13 +72,13 @@ internal sealed class TermInfosWriter : IDisposable /// smaller values result in bigger indexes, less acceleration and more /// accelerable cases. More detailed experiments would be useful here. /// - internal int skipInterval = 16; + internal const int skipInterval = 16; // LUCENENET: marked const /// /// Expert: The maximum number of skip levels. Smaller values result in /// slightly smaller indexes, but slower skipping in big posting lists. /// - internal int maxSkipLevels = 10; + internal const int maxSkipLevels = 10; // LUCENENET: marked const private long lastIndexPointer; private bool isIndex; @@ -328,4 +328,4 @@ public void Dispose() } } #pragma warning restore 612, 618 -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs index 0a9d12e9b9..0aa798649d 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42DocValuesConsumer.cs @@ -379,8 +379,8 @@ IEnumerator IEnumerable.GetEnumerator() internal sealed class SortedSetEnumerator : IEnumerator { internal byte[] buffer = new byte[10]; - internal ByteArrayDataOutput @out = new ByteArrayDataOutput(); - internal BytesRef @ref = new BytesRef(); + internal readonly ByteArrayDataOutput @out = new ByteArrayDataOutput(); // LUCENENET: marked readonly + internal readonly BytesRef @ref = new BytesRef(); // LUCENENET: marked readonly internal readonly IEnumerator counts; internal readonly IEnumerator ords; diff --git a/src/Lucene.Net.TestFramework/Search/CheckHits.cs b/src/Lucene.Net.TestFramework/Search/CheckHits.cs index 51dcf60320..c58264fa1e 100644 --- a/src/Lucene.Net.TestFramework/Search/CheckHits.cs +++ b/src/Lucene.Net.TestFramework/Search/CheckHits.cs @@ -485,10 +485,10 @@ public override TopDocs Search(Query query, Filter filter, int n) /// public class ExplanationAsserter : ICollector { - internal Query q; - internal IndexSearcher s; - internal string d; - internal bool deep; + internal readonly Query q; // LUCENENET: marked readonly + internal readonly IndexSearcher s; // LUCENENET: marked readonly + internal readonly string d; // LUCENENET: marked readonly + internal readonly bool deep; // LUCENENET: marked readonly internal Scorer scorer; internal int @base = 0; diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs index 5986ea40e4..b245707817 100644 --- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs @@ -102,7 +102,7 @@ public class MockDirectoryWrapper : BaseDirectoryWrapper internal double randomIOExceptionRate; internal double randomIOExceptionRateOnOpen; - internal Random randomState; + internal readonly Random randomState; // LUCENENET: marked readonly internal bool noDeleteOpenFile = true; internal bool assertNoDeleteOpenFile = false; internal bool preventDoubleWrite = true; @@ -113,7 +113,7 @@ public class MockDirectoryWrapper : BaseDirectoryWrapper private ISet unSyncedFiles; private ISet createdFiles; private ISet openFilesForWrite = new JCG.HashSet(StringComparer.Ordinal); - internal ISet openLocks = new ConcurrentHashSet(StringComparer.Ordinal); + internal readonly ISet openLocks = new ConcurrentHashSet(StringComparer.Ordinal); // LUCENENET: marked readonly internal volatile bool crashed; private readonly ThrottledIndexOutput throttledOutput; // LUCENENET: marked readonly private Throttling throttling = Throttling.SOMETIMES; diff --git a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs index e55765efc1..609c3606d1 100644 --- a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs @@ -37,7 +37,7 @@ public class MockIndexOutputWrapper : IndexOutput private bool first = true; internal readonly string name; - internal byte[] singleByte = new byte[1]; + internal readonly byte[] singleByte = new byte[1]; // LUCENENET: marked readonly /// /// Construct an empty output buffer. diff --git a/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs index 0a8e175488..2d0e5e7c35 100644 --- a/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockLockFactoryWrapper.cs @@ -23,8 +23,8 @@ namespace Lucene.Net.Store /// public class MockLockFactoryWrapper : LockFactory { - internal MockDirectoryWrapper dir; - internal LockFactory @delegate; + internal readonly MockDirectoryWrapper dir; // LUCENENET: marked readonly + internal readonly LockFactory @delegate; // LUCENENET: marked readonly public MockLockFactoryWrapper(MockDirectoryWrapper dir, LockFactory @delegate) { @@ -58,8 +58,8 @@ private class MockLock : Lock { private readonly MockLockFactoryWrapper outerInstance; - internal Lock delegateLock; - internal string name; + internal readonly Lock delegateLock; // LUCENENET: marked readonly + internal readonly string name; // LUCENENET: marked readonly internal MockLock(MockLockFactoryWrapper outerInstance, Lock @delegate, string name) { @@ -96,4 +96,4 @@ public override bool IsLocked() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs index 81b24930d5..a4ff76a940 100644 --- a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs +++ b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs @@ -557,7 +557,7 @@ public override string ToString() } internal readonly Outputs fstOutputs = ByteSequenceOutputs.Singleton; - internal BytesRef NO_OUTPUT; + internal readonly BytesRef NO_OUTPUT; // LUCENENET: marked readonly /// /// BlockTree's implementation of . diff --git a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs index 936c92888a..8597cec240 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/SegmentTermEnum.cs @@ -35,8 +35,8 @@ namespace Lucene.Net.Codecs.Lucene3x internal sealed class SegmentTermEnum : IDisposable // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation { private IndexInput input; - internal FieldInfos fieldInfos; - internal long size; + internal readonly FieldInfos fieldInfos; // LUCENENET: marked readonly + internal readonly long size; // LUCENENET: marked readonly internal long position = -1; // Changed strings to true utf8 with length-in-bytes not @@ -59,10 +59,10 @@ internal sealed class SegmentTermEnum : IDisposable // LUCENENET specific: Not i private readonly int format; // LUCENENET: marked readonly private readonly bool isIndex = false; // LUCENENET: marked readonly internal long indexPointer = 0; - internal int indexInterval; // LUCENENET NOTE: Changed from public field to internal (class is internal anyway) - internal int skipInterval; + internal readonly int indexInterval; // LUCENENET NOTE: Changed from public field to internal (class is internal anyway), marked readonly + internal readonly int skipInterval; // LUCENENET: marked readonly internal int newSuffixStart; - internal int maxSkipLevels; + internal readonly int maxSkipLevels; // LUCENENET: marked readonly private bool first = true; public SegmentTermEnum(IndexInput i, FieldInfos fis, bool isi) @@ -262,4 +262,4 @@ public void Dispose() input.Dispose(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs index c08a988939..e2ff36dd5b 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReader.cs @@ -74,7 +74,7 @@ public TermInfoAndOrd(TermInfo ti, long termOrd) private class CloneableTerm : DoubleBarrelLRUCache.CloneableKey { - internal Term term; + internal readonly Term term; // LUCENENET: marked readonly public CloneableTerm(Term t) { diff --git a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs index 3a2e6b2292..78ddd01cee 100644 --- a/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs +++ b/src/Lucene.Net/Codecs/Lucene40/Lucene40TermVectorsWriter.cs @@ -191,7 +191,7 @@ public override void StartTerm(BytesRef term, int freq) internal int lastOffset = 0; internal int lastPayloadLength = -1; // force first payload to write its length - internal BytesRef scratch = new BytesRef(); // used only by this optimized flush below + internal readonly BytesRef scratch = new BytesRef(); // used only by this optimized flush below // LUCENENET: marked readonly public override void AddProx(int numProx, DataInput positions, DataInput offsets) { diff --git a/src/Lucene.Net/Document/Field.cs b/src/Lucene.Net/Document/Field.cs index 36233835e0..8a2d27f80a 100644 --- a/src/Lucene.Net/Document/Field.cs +++ b/src/Lucene.Net/Document/Field.cs @@ -35,8 +35,8 @@ namespace Lucene.Net.Documents /// /// Expert: directly create a field for a document. Most - /// users should use one of the sugar subclasses: , - /// , , , + /// users should use one of the sugar subclasses: , + /// , , , /// , , /// , , /// , . @@ -44,7 +44,7 @@ namespace Lucene.Net.Documents /// A field is a section of a . Each field has three /// parts: name, type and value. Values may be text /// (, or pre-analyzed ), binary - /// (), or numeric (, , , or ). + /// (), or numeric (, , , or ). /// Fields are optionally stored in the /// index, so that they may be returned with hits on the document. /// @@ -72,7 +72,7 @@ public partial class Field : IIndexableField, IFormattable private object fieldsData; /// - /// Field's value + /// Field's value /// /// Setting this property will automatically set the backing field for the /// property. @@ -320,7 +320,7 @@ public virtual string GetStringValue() // LUCENENET specific: Added verb Get to /// An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric. /// The string representation of the value if it is either a or numeric type. // LUCENENET specific overload. - public virtual string GetStringValue(IFormatProvider provider) + public virtual string GetStringValue(IFormatProvider provider) { return GetStringValue(null, provider); } @@ -333,7 +333,7 @@ public virtual string GetStringValue(IFormatProvider provider) /// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric. /// The string representation of the value if it is either a or numeric type. // LUCENENET specific overload. - public virtual string GetStringValue(string format) + public virtual string GetStringValue(string format) { return GetStringValue(format, null); } @@ -411,7 +411,7 @@ public virtual void SetStringValue(string value) } /// - /// Expert: change the value of this field. See + /// Expert: change the value of this field. See /// . /// public virtual void SetReaderValue(TextReader value) @@ -532,7 +532,7 @@ public virtual void SetDoubleValue(double value) // LUCENENET TODO: Add SetValue() overloads for each type? // Upside: Simpler API. - // Downside: Must be vigilant about what type is passed or the wrong overload will be called and will get a runtime exception. + // Downside: Must be vigilant about what type is passed or the wrong overload will be called and will get a runtime exception. /// /// Expert: sets the token stream to be used for indexing and causes @@ -602,15 +602,15 @@ public virtual object GetNumericValue() // LUCENENET specific: Added verb Get to /// /// Gets the of the underlying value, or if the value is not set or non-numeric. /// - /// Expert: The difference between this property and is + /// Expert: The difference between this property and is /// this is represents the current state of the field (whether being written or read) and the /// property represents instructions on how the field will be written, /// but does not re-populate when reading back from an index (it is write-only). /// - /// In Java, the numeric type was determined by checking the type of + /// In Java, the numeric type was determined by checking the type of /// . However, since there are no reference number /// types in .NET, using so will cause boxing/unboxing. It is - /// therefore recommended to use this property to check the underlying type and the corresponding + /// therefore recommended to use this property to check the underlying type and the corresponding /// Get*Value() method to retrieve the value. /// /// NOTE: Since Lucene codecs do not support or , @@ -770,7 +770,7 @@ public override string ToString() } /// - /// Prints a for human consumption. + /// Prints a for human consumption. /// /// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric. // LUCENENET specific - method added for better .NET compatibility @@ -906,8 +906,8 @@ public virtual TokenStream GetTokenStream(Analyzer analyzer) internal sealed class StringTokenStream : TokenStream { - internal ICharTermAttribute termAttribute; - internal IOffsetAttribute offsetAttribute; + internal readonly ICharTermAttribute termAttribute; // LUCENENET: marked readonly + internal readonly IOffsetAttribute offsetAttribute; // LUCENENET: marked readonly internal bool used = false; internal string value = null; @@ -985,7 +985,7 @@ public enum Store // /// - /// Specifies whether and how a field should be indexed. + /// Specifies whether and how a field should be indexed. /// [Obsolete("This is here only to ease transition from the pre-4.0 APIs.")] public enum Index @@ -1035,13 +1035,13 @@ public enum Index } /// - /// Specifies whether and how a field should have term vectors. + /// Specifies whether and how a field should have term vectors. /// [Obsolete("This is here only to ease transition from the pre-4.0 APIs.")] public enum TermVector { /// - /// Do not store term vectors. + /// Do not store term vectors. /// NO, @@ -1197,7 +1197,7 @@ public Field(string name, TextReader reader) } /// - /// Create a tokenized and indexed field that is not stored, optionally with + /// Create a tokenized and indexed field that is not stored, optionally with /// storing term vectors. The is read only when the is added to the index, /// i.e. you may not close the until /// has been called. @@ -1229,7 +1229,7 @@ public Field(string name, TokenStream tokenStream) } /// - /// Create a tokenized and indexed field that is not stored, optionally with + /// Create a tokenized and indexed field that is not stored, optionally with /// storing term vectors. This is useful for pre-analyzed fields. /// The is read only when the is added to the index, /// i.e. you may not close the until @@ -1412,7 +1412,7 @@ public static Field.Index ToIndex(bool indexed, bool analyed) } [Obsolete("This is here only to ease transition from the pre-4.0 APIs.")] - public static Field.Index ToIndex(bool indexed, bool analyzed, bool omitNorms) + public static Field.Index ToIndex(bool indexed, bool analyzed, bool omitNorms) { // If it is not indexed nothing else matters if (!indexed) @@ -1473,8 +1473,8 @@ public static Field.TermVector ToTermVector(bool stored, bool withOffsets, bool // LUCENENET specific // Since we have more numeric types on Field than on FieldType, // a new enumeration was created for .NET. In Java, this type was - // determined by checking the data type of the Field.numericValue() - // method. However, since the corresponding GetNumericValue() method + // determined by checking the data type of the Field.numericValue() + // method. However, since the corresponding GetNumericValue() method // in .NET returns type object (which would result in boxing/unboxing), // this has been refactored to use an enumeration instead, which makes the // API easier to use. @@ -1511,8 +1511,8 @@ public enum NumericFieldType SINGLE, /// - /// 64-bit double numeric type + /// 64-bit double numeric type /// DOUBLE } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs b/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs index b506af1e98..c1f55341c8 100644 --- a/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs +++ b/src/Lucene.Net/Index/ConcurrentMergeScheduler.cs @@ -293,7 +293,7 @@ protected virtual void UpdateMergeThreads() /// conjunction with , like that: /// /// - /// if (IsVerbose) + /// if (IsVerbose) /// { /// Message("your message"); /// } @@ -571,8 +571,8 @@ protected internal class MergeThread : ThreadJob { private readonly ConcurrentMergeScheduler outerInstance; - internal IndexWriter tWriter; - internal MergePolicy.OneMerge startMerge; + internal readonly IndexWriter tWriter; // LUCENENET: marked readonly + internal readonly MergePolicy.OneMerge startMerge; // LUCENENET: marked readonly internal MergePolicy.OneMerge runningMerge; private volatile bool done; @@ -616,7 +616,7 @@ public virtual MergePolicy.OneMerge RunningMerge } /// - /// Return the current merge, or null if this + /// Return the current merge, or null if this /// is done. /// public virtual MergePolicy.OneMerge CurrentMerge @@ -814,4 +814,4 @@ public override object Clone() return clone; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs index e71af22fe9..6ac584bbdf 100644 --- a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs +++ b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs @@ -105,7 +105,7 @@ public class DocState { internal readonly DocumentsWriterPerThread docWriter; internal Analyzer analyzer; - internal InfoStream infoStream; + internal readonly InfoStream infoStream; // LUCENENET: marked readonly internal Similarity similarity; internal int docID; internal IEnumerable doc; diff --git a/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs b/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs index 3fd3db8889..de5a18a812 100644 --- a/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs +++ b/src/Lucene.Net/Index/FreqProxTermsWriterPerField.cs @@ -328,11 +328,11 @@ public FreqProxPostingsArray(int size, bool writeFreqs, bool writeProx, bool wri //System.out.println("PA init freqs=" + writeFreqs + " pos=" + writeProx + " offs=" + writeOffsets); } - internal int[] termFreqs; // # times this term occurs in the current doc - internal int[] lastDocIDs; // Last docID where this term occurred - internal int[] lastDocCodes; // Code for prior doc - internal int[] lastPositions; // Last position where this term occurred - internal int[] lastOffsets; // Last endOffset where this term occurred + internal readonly int[] termFreqs; // # times this term occurs in the current doc // LUCENENET: marked readonly + internal readonly int[] lastDocIDs; // Last docID where this term occurred // LUCENENET: marked readonly + internal readonly int[] lastDocCodes; // Code for prior doc // LUCENENET: marked readonly + internal readonly int[] lastPositions; // Last position where this term occurred // LUCENENET: marked readonly + internal readonly int[] lastOffsets; // Last endOffset where this term occurred // LUCENENET: marked readonly internal override ParallelPostingsArray NewInstance(int size) { diff --git a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs index b9968577c1..7afdee629a 100644 --- a/src/Lucene.Net/Index/FrozenBufferedUpdates.cs +++ b/src/Lucene.Net/Index/FrozenBufferedUpdates.cs @@ -40,7 +40,7 @@ internal class FrozenBufferedUpdates /// Terms, in sorted order: internal readonly PrefixCodedTerms terms; - internal int termCount; // just for debugging + internal readonly int termCount; // just for debugging // LUCENENET: marked readonly /// Parallel array of deleted query, and the docIDUpto for each internal readonly Query[] queries; @@ -252,4 +252,4 @@ public virtual bool Any() return termCount > 0 || queries.Length > 0 || numericDVUpdates.Length > 0 || binaryDVUpdates.Length > 0; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs index 4ad0b7c235..f412ac5998 100644 --- a/src/Lucene.Net/Index/IndexFileDeleter.cs +++ b/src/Lucene.Net/Index/IndexFileDeleter.cs @@ -750,12 +750,12 @@ public int DecRef() private sealed class CommitPoint : IndexCommit { - internal ICollection files; - internal string segmentsFileName; + internal readonly ICollection files; // LUCENENET: marked readonly + internal readonly string segmentsFileName; // LUCENENET: marked readonly internal bool deleted; - internal Directory directory; - internal ICollection commitsToDelete; - internal long generation; + internal readonly Directory directory; // LUCENENET: marked readonly + internal readonly ICollection commitsToDelete; // LUCENENET: marked readonly + internal readonly long generation; // LUCENENET: marked readonly internal readonly IDictionary userData; internal readonly int segmentCount; diff --git a/src/Lucene.Net/Index/IndexWriter.cs b/src/Lucene.Net/Index/IndexWriter.cs index f98cdd709f..be24ca1a11 100644 --- a/src/Lucene.Net/Index/IndexWriter.cs +++ b/src/Lucene.Net/Index/IndexWriter.cs @@ -271,7 +271,7 @@ public class IndexWriter : IDisposable, ITwoPhaseCommit internal readonly AtomicInt32 flushCount = new AtomicInt32(); internal readonly AtomicInt32 flushDeletesCount = new AtomicInt32(); - internal ReaderPool readerPool; + internal readonly ReaderPool readerPool; // LUCENENET: marked readonly internal readonly BufferedUpdatesStream bufferedUpdatesStream; // this is a "write once" variable (like the organic dye diff --git a/src/Lucene.Net/Index/StandardDirectoryReader.cs b/src/Lucene.Net/Index/StandardDirectoryReader.cs index 19776dd153..e22a17f94d 100644 --- a/src/Lucene.Net/Index/StandardDirectoryReader.cs +++ b/src/Lucene.Net/Index/StandardDirectoryReader.cs @@ -506,10 +506,10 @@ public override IndexCommit IndexCommit internal sealed class ReaderCommit : IndexCommit { - internal string segmentsFileName; - internal ICollection files; - internal Directory dir; - internal long generation; + internal readonly string segmentsFileName; // LUCENENET: marked readonly + internal readonly ICollection files; // LUCENENET: marked readonly + internal readonly Directory dir; // LUCENENET: marked readonly + internal readonly long generation; // LUCENENET: marked readonly internal readonly IDictionary userData; internal readonly int segmentCount; @@ -548,4 +548,4 @@ public override void Delete() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs b/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs index 87d43314d6..64631edb3c 100644 --- a/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs +++ b/src/Lucene.Net/Index/TermVectorsConsumerPerField.cs @@ -146,7 +146,7 @@ internal override bool Start(IIndexableField[] fields, int count) /// Called once per field per document if term vectors /// are enabled, to write the vectors to /// RAMOutputStream, which is then quickly flushed to - /// the real term vectors files in the Directory. + /// the real term vectors files in the Directory. /// internal override void Finish() { @@ -330,9 +330,9 @@ public TermVectorsPostingsArray(int size) lastPositions = new int[size]; } - internal int[] freqs; // How many times this term occurred in the current doc - internal int[] lastOffsets; // Last offset we saw - internal int[] lastPositions; // Last position where this term occurred + internal readonly int[] freqs; // How many times this term occurred in the current doc // LUCENENET: marked readonly + internal readonly int[] lastOffsets; // Last offset we saw // LUCENENET: marked readonly + internal readonly int[] lastPositions; // Last position where this term occurred // LUCENENET: marked readonly internal override ParallelPostingsArray NewInstance(int size) { @@ -357,4 +357,4 @@ internal override int BytesPerPosting() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/BooleanScorer2.cs b/src/Lucene.Net/Search/BooleanScorer2.cs index 7fa1c89fb3..fffdf5165b 100644 --- a/src/Lucene.Net/Search/BooleanScorer2.cs +++ b/src/Lucene.Net/Search/BooleanScorer2.cs @@ -114,7 +114,7 @@ private class SingleMatchScorer : Scorer { private readonly BooleanScorer2 outerInstance; - internal Scorer scorer; + internal readonly Scorer scorer; // LUCENENET: marked readonly internal int lastScoredDoc = -1; // Save the score of lastScoredDoc, so that we don't compute it more than @@ -274,7 +274,7 @@ private Scorer DualConjunctionSumScorer(/* bool disableCoord, // LUCENENET: Not /// private Scorer MakeCountingSumScorer(/* bool disableCoord // LUCENENET: Not Referenced */) // each scorer counted as a single matcher { - return (requiredScorers.Count == 0) + return (requiredScorers.Count == 0) ? MakeCountingSumScorerNoReq(/* disableCoord // LUCENENET: Not Referenced */) : MakeCountingSumScorerSomeReq(/* disableCoord // LUCENENET: Not Referenced */); } @@ -376,4 +376,4 @@ public override ICollection GetChildren() return children; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs index 083c9d3b60..0f2dd95b9c 100644 --- a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs +++ b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs @@ -178,7 +178,7 @@ public override bool Collect(BytesRef bytes) internal readonly int docCountCutoff, termCountLimit; internal readonly TermStateByteStart array = new TermStateByteStart(16); - internal BytesRefHash pendingTerms; + internal readonly BytesRefHash pendingTerms; // LUCENENET: marked readonly } public override int GetHashCode() diff --git a/src/Lucene.Net/Search/ExactPhraseScorer.cs b/src/Lucene.Net/Search/ExactPhraseScorer.cs index bcc7aaa600..ed33290c1a 100644 --- a/src/Lucene.Net/Search/ExactPhraseScorer.cs +++ b/src/Lucene.Net/Search/ExactPhraseScorer.cs @@ -33,7 +33,7 @@ internal sealed class ExactPhraseScorer : Scorer private readonly int[] counts = new int[CHUNK]; private readonly int[] gens = new int[CHUNK]; - internal bool noDocs; + internal readonly bool noDocs; // LUCENENET: marked readonly private readonly long cost; private sealed class ChunkState @@ -358,4 +358,4 @@ public override long GetCost() return cost; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/FieldCacheImpl.cs b/src/Lucene.Net/Search/FieldCacheImpl.cs index ef25545cae..b038c5c377 100644 --- a/src/Lucene.Net/Search/FieldCacheImpl.cs +++ b/src/Lucene.Net/Search/FieldCacheImpl.cs @@ -290,7 +290,7 @@ private protected Cache(FieldCacheImpl wrapper) // LUCENENET: Changed from inter internal readonly FieldCacheImpl wrapper; - internal ConditionalWeakTable> readerCache = new ConditionalWeakTable>(); + internal readonly ConditionalWeakTable> readerCache = new ConditionalWeakTable>(); // LUCENENET: marked readonly protected abstract TValue CreateValue(AtomicReader reader, TKey key, bool setDocsWithField); diff --git a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs index 816dc404dd..558b27f9ed 100644 --- a/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs +++ b/src/Lucene.Net/Search/Payloads/PayloadNearQuery.cs @@ -210,7 +210,7 @@ public class PayloadNearSpanScorer : SpanScorer { private readonly PayloadNearQuery outerInstance; - internal Spans spans; + internal readonly Spans spans; // LUCENENET: marked readonly protected internal float m_payloadScore; internal int payloadsSeen; @@ -251,7 +251,7 @@ public virtual void GetPayloads(Spans[] subSpans) } // TODO change the whole spans api to use bytesRef, or nuke spans - internal BytesRef scratch = new BytesRef(); + internal readonly BytesRef scratch = new BytesRef(); // LUCENENET: marked readonly /// /// By default, uses the to score the payloads, but diff --git a/src/Lucene.Net/Search/PhrasePositions.cs b/src/Lucene.Net/Search/PhrasePositions.cs index d90d4b4e4a..a9bd7b7e5d 100644 --- a/src/Lucene.Net/Search/PhrasePositions.cs +++ b/src/Lucene.Net/Search/PhrasePositions.cs @@ -27,7 +27,7 @@ internal sealed class PhrasePositions internal int doc; // current doc internal int position; // position in doc internal int count; // remaining pos in this doc - internal int offset; // position in phrase + internal readonly int offset; // position in phrase // LUCENENET: marked readonly internal readonly int ord; // unique across all PhrasePositions instances internal readonly DocsAndPositionsEnum postings; // stream of docs & positions internal PhrasePositions next; // used to make lists @@ -100,4 +100,4 @@ public override string ToString() return s; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/PhraseQuery.cs b/src/Lucene.Net/Search/PhraseQuery.cs index b579477448..cc0f1e0164 100644 --- a/src/Lucene.Net/Search/PhraseQuery.cs +++ b/src/Lucene.Net/Search/PhraseQuery.cs @@ -304,7 +304,7 @@ private class PhraseWeight : Weight internal readonly Similarity.SimWeight stats; - internal TermContext[] states; + internal readonly TermContext[] states; // LUCENENET: marked readonly public PhraseWeight(PhraseQuery outerInstance, IndexSearcher searcher) { diff --git a/src/Lucene.Net/Search/ScoringRewrite.cs b/src/Lucene.Net/Search/ScoringRewrite.cs index 31e4996fd7..cd90ba3a84 100644 --- a/src/Lucene.Net/Search/ScoringRewrite.cs +++ b/src/Lucene.Net/Search/ScoringRewrite.cs @@ -147,7 +147,7 @@ public ParallelArraysTermCollector(ScoringRewrite outerInstance) } internal readonly TermFreqBoostByteStart array = new TermFreqBoostByteStart(16); - internal BytesRefHash terms; + internal readonly BytesRefHash terms; // LUCENENET: marked readonly internal TermsEnum termsEnum; private IBoostAttribute boostAtt; diff --git a/src/Lucene.Net/Search/SortField.cs b/src/Lucene.Net/Search/SortField.cs index 299ad948cf..4dd0980558 100644 --- a/src/Lucene.Net/Search/SortField.cs +++ b/src/Lucene.Net/Search/SortField.cs @@ -48,7 +48,7 @@ public class SortField private string field; private SortFieldType type; // defaults to determining type dynamically - internal bool reverse = false; // defaults to natural order + internal readonly bool reverse /*= false*/; // defaults to natural order // LUCENENET: marked readonly private readonly FieldCache.IParser parser; // LUCENENET: marked readonly // Used for CUSTOM sort diff --git a/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs b/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs index ef81809b2b..ab60f8c09a 100644 --- a/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs +++ b/src/Lucene.Net/Search/Spans/NearSpansUnordered.cs @@ -80,7 +80,7 @@ private class SpansCell : Spans { private readonly NearSpansUnordered outerInstance; - internal Spans spans; + internal readonly Spans spans; // LUCENENET: marked readonly internal SpansCell next; private int length = -1; private readonly int index; // LUCENENET: marked readonly @@ -384,4 +384,4 @@ private void ListToQueue() private bool AtMatch => (Min.Doc == max.Doc) && ((max.End - Min.Start - totalLength) <= slop); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/SimpleFSLockFactory.cs b/src/Lucene.Net/Store/SimpleFSLockFactory.cs index 29733cd43b..27e0932b87 100644 --- a/src/Lucene.Net/Store/SimpleFSLockFactory.cs +++ b/src/Lucene.Net/Store/SimpleFSLockFactory.cs @@ -22,8 +22,8 @@ namespace Lucene.Net.Store */ /// - /// Implements using - /// + /// Implements using + /// /// (writes the file with UTF8 encoding and no byte order mark). /// /// Special care needs to be taken if you change the locking @@ -36,7 +36,7 @@ namespace Lucene.Net.Store /// /// If you suspect that this or any other is /// not working properly in your environment, you can easily - /// test it by using , + /// test it by using , /// and . /// /// @@ -103,8 +103,8 @@ public override void ClearLock(string lockName) internal class SimpleFSLock : Lock { - internal FileInfo lockFile; - internal DirectoryInfo lockDir; + internal readonly FileInfo lockFile; // LUCENENET: marked readonly + internal readonly DirectoryInfo lockDir; // LUCENENET: marked readonly public SimpleFSLock(DirectoryInfo lockDir, string lockFileName) { @@ -184,4 +184,4 @@ public override string ToString() return "SimpleFSLock@" + lockFile; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/SingleInstanceLockFactory.cs b/src/Lucene.Net/Store/SingleInstanceLockFactory.cs index f78bc0b54a..ba411b7337 100644 --- a/src/Lucene.Net/Store/SingleInstanceLockFactory.cs +++ b/src/Lucene.Net/Store/SingleInstanceLockFactory.cs @@ -61,7 +61,7 @@ public override void ClearLock(string lockName) internal class SingleInstanceLock : Lock { - internal string lockName; + internal readonly string lockName; // LUCENENET: marked readonly private readonly JCG.HashSet locks; public SingleInstanceLock(JCG.HashSet locks, string lockName) @@ -117,4 +117,4 @@ public override string ToString() return base.ToString() + ": " + lockName; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs index 48a8b1cd51..8ef25fd129 100644 --- a/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs +++ b/src/Lucene.Net/Util/Automaton/LevenshteinAutomata.cs @@ -48,9 +48,9 @@ public class LevenshteinAutomata /* the ranges outside of alphabet */ internal readonly int[] rangeLower; internal readonly int[] rangeUpper; - internal int numRanges = 0; + internal readonly int numRanges /*= 0*/; // LUCENENET: marked readonly - internal ParametricDescription[] descriptions; + internal readonly ParametricDescription[] descriptions; // LUCENENET: marked readonly /// /// Create a new for some string. @@ -338,4 +338,4 @@ protected internal virtual int Unpack(long[] data, int index, int bitsPerValue) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Automaton/RegExp.cs b/src/Lucene.Net/Util/Automaton/RegExp.cs index 1e7a6c975b..92c7bb5dc8 100644 --- a/src/Lucene.Net/Util/Automaton/RegExp.cs +++ b/src/Lucene.Net/Util/Automaton/RegExp.cs @@ -108,7 +108,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// unionexp /// ::= @@ -123,7 +123,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// interexp /// ::= @@ -138,7 +138,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// concatexp /// ::= @@ -153,7 +153,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// repeatexp /// ::= @@ -203,7 +203,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// complexp /// ::= @@ -218,7 +218,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// charclassexp /// ::= @@ -240,7 +240,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// charclasses /// ::= @@ -255,7 +255,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// charclass /// ::= @@ -270,7 +270,7 @@ public enum RegExpSyntax /// /// /// - /// + /// /// /// simpleexp /// ::= @@ -334,7 +334,7 @@ public enum RegExpSyntax /// (numerical interval) /// [OPTIONAL] /// - /// + /// /// /// charexp /// ::= @@ -349,9 +349,9 @@ public enum RegExpSyntax /// (a single character) /// /// - /// + /// /// - /// + /// /// /// The productions marked [OPTIONAL] are only allowed if /// specified by the syntax flags passed to the constructor. @@ -402,8 +402,8 @@ internal enum Kind internal int min, max, digits; internal int from, to; - internal string b; - internal RegExpSyntax flags; + internal readonly string b; // LUCENENET: marked readonly + internal readonly RegExpSyntax flags; // LUCENENET: marked readonly internal int pos; internal RegExp() @@ -1336,4 +1336,4 @@ internal int ParseCharExp() return Next(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs index 673a8fda5f..8fc175131f 100644 --- a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs +++ b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs @@ -264,9 +264,9 @@ public override string ToString() /// public struct FrozenInt32Set : IEquatable { - internal int[] values; - internal int hashCode; - internal State state; + internal readonly int[] values; // LUCENENET: marked readonly + internal readonly int hashCode; // LUCENENET: marked readonly + internal readonly State state; // LUCENENET: marked readonly public FrozenInt32Set(int[] values, int hashCode, State state) { @@ -353,4 +353,4 @@ public override string ToString() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Automaton/State.cs b/src/Lucene.Net/Util/Automaton/State.cs index ccc5ca5aff..20ea792de1 100644 --- a/src/Lucene.Net/Util/Automaton/State.cs +++ b/src/Lucene.Net/Util/Automaton/State.cs @@ -57,7 +57,7 @@ public class State : IComparable internal int number; - internal int id; + internal readonly int id; // LUCENENET: marked readonly internal static int next_id; /// diff --git a/src/Lucene.Net/Util/Automaton/StatePair.cs b/src/Lucene.Net/Util/Automaton/StatePair.cs index 79d1e168ff..7775352f0d 100644 --- a/src/Lucene.Net/Util/Automaton/StatePair.cs +++ b/src/Lucene.Net/Util/Automaton/StatePair.cs @@ -39,8 +39,8 @@ namespace Lucene.Net.Util.Automaton public class StatePair { internal State s; - internal State s1; - internal State s2; + internal readonly State s1; // LUCENENET: marked readonly + internal readonly State s2; // LUCENENET: marked readonly internal StatePair(State s, State s1, State s2) { diff --git a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs index c5c8c84bf1..208c15d061 100644 --- a/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs +++ b/src/Lucene.Net/Util/Automaton/UTF32ToUTF8.cs @@ -392,4 +392,4 @@ private State NewUTF8State() return s; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/CollectionUtil.cs b/src/Lucene.Net/Util/CollectionUtil.cs index 71c548096c..95d443b168 100644 --- a/src/Lucene.Net/Util/CollectionUtil.cs +++ b/src/Lucene.Net/Util/CollectionUtil.cs @@ -34,7 +34,7 @@ public static class CollectionUtil // LUCENENET specific - made static private sealed class ListIntroSorter : IntroSorter { internal T pivot; - internal IList list; + internal readonly IList list; // LUCENENET: marked readonly internal readonly IComparer comp; internal ListIntroSorter(IList list, IComparer comp) @@ -45,7 +45,7 @@ internal ListIntroSorter(IList list, IComparer comp) //{ // throw new ArgumentException("CollectionUtil can only sort random access lists in-place."); //} - + this.list = list; this.comp = comp; } @@ -77,7 +77,7 @@ protected override int ComparePivot(int j) private sealed class ListTimSorter : TimSorter { - internal IList list; + internal readonly IList list; // LUCENENET: marked readonly internal readonly IComparer comp; internal readonly T[] tmp; @@ -144,7 +144,7 @@ protected override int CompareSaved(int i, int j) /// /// Sorts the given using the . /// This method uses the intro sort - /// algorithm, but falls back to insertion sort for small lists. + /// algorithm, but falls back to insertion sort for small lists. /// /// This /// The to use for the sort. @@ -161,7 +161,7 @@ public static void IntroSort(IList list, IComparer comp) /// /// Sorts the given random access in natural order. /// This method uses the intro sort - /// algorithm, but falls back to insertion sort for small lists. + /// algorithm, but falls back to insertion sort for small lists. /// /// This public static void IntroSort(IList list) @@ -211,4 +211,4 @@ public static void TimSort(IList list) TimSort(list, ArrayUtil.GetNaturalComparer()); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/IndexableBinaryStringTools.cs b/src/Lucene.Net/Util/IndexableBinaryStringTools.cs index 68e8f5c122..c63632fcbd 100644 --- a/src/Lucene.Net/Util/IndexableBinaryStringTools.cs +++ b/src/Lucene.Net/Util/IndexableBinaryStringTools.cs @@ -299,8 +299,8 @@ public static void Decode(char[] inputArray, int inputOffset, int inputLength, s internal class CodingCase { - internal int numBytes, initialShift, middleShift, finalShift, advanceBytes = 2; - internal short middleMask, finalMask; + internal readonly int numBytes, initialShift, middleShift, finalShift, advanceBytes = 2; // LUCENENET: marked readonly + internal readonly short middleMask, finalMask; // LUCENENET: marked readonly internal CodingCase(int initialShift, int middleShift, int finalShift) { diff --git a/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs b/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs index 61578feb4c..64d10bb0c2 100644 --- a/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs +++ b/src/Lucene.Net/Util/Packed/AbstractAppendingLongBuffer.cs @@ -22,7 +22,7 @@ namespace Lucene.Net.Util.Packed */ /// - /// Common functionality shared by and . + /// Common functionality shared by and . /// /// NOTE: This was AbstractAppendingLongBuffer in Lucene /// @@ -40,7 +40,7 @@ public abstract class AbstractAppendingInt64Buffer : Int64Values // LUCENENET NO internal int valuesOff; internal long[] pending; internal int pendingOff; - internal float acceptableOverheadRatio; + internal readonly float acceptableOverheadRatio; // LUCENENET: marked readonly private protected AbstractAppendingInt64Buffer(int initialBlockCount, int pageSize, float acceptableOverheadRatio) // LUCENENET: Changed from internal to private protected { @@ -142,7 +142,7 @@ public int Get(long index, long[] arr, int off, int len) internal abstract int Get(int block, int element, long[] arr, int off, int len); /// - /// Return an iterator over the values of this buffer. + /// Return an iterator over the values of this buffer. /// public virtual Iterator GetIterator() { @@ -220,11 +220,11 @@ public long Next() [MethodImpl(MethodImplOptions.AggressiveInlining)] internal virtual long BaseRamBytesUsed() { - return RamUsageEstimator.NUM_BYTES_OBJECT_HEADER - + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF - + 2 * RamUsageEstimator.NUM_BYTES_INT32 - + 2 * RamUsageEstimator.NUM_BYTES_INT32 - + RamUsageEstimator.NUM_BYTES_SINGLE + return RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + + 2 * RamUsageEstimator.NUM_BYTES_INT32 + + 2 * RamUsageEstimator.NUM_BYTES_INT32 + + RamUsageEstimator.NUM_BYTES_SINGLE + RamUsageEstimator.NUM_BYTES_INT64; // valuesBytes - acceptable overhead - pageShift, pageMask - the 2 offsets - the 2 arrays } @@ -256,4 +256,4 @@ public virtual void Freeze() pending = null; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/PriorityQueue.cs b/src/Lucene.Net/Util/PriorityQueue.cs index 6f3e680b55..5f3f74e97d 100644 --- a/src/Lucene.Net/Util/PriorityQueue.cs +++ b/src/Lucene.Net/Util/PriorityQueue.cs @@ -128,6 +128,7 @@ public abstract class PriorityComparer : IComparer /// /// @lucene.internal /// + [SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")] public ref struct ValuePriorityQueue { private int size; diff --git a/src/Lucene.Net/Util/RollingBuffer.cs b/src/Lucene.Net/Util/RollingBuffer.cs index 519646e039..93f0e10e48 100644 --- a/src/Lucene.Net/Util/RollingBuffer.cs +++ b/src/Lucene.Net/Util/RollingBuffer.cs @@ -72,7 +72,7 @@ public abstract class RollingBuffer // How many valid Position are held in the // array: private int count; - private IRollingBufferItemFactory itemFactory; + private readonly IRollingBufferItemFactory itemFactory; // LUCENENET: marked readonly protected RollingBuffer(IRollingBufferItemFactory itemFactory) { @@ -187,4 +187,4 @@ public virtual void FreeBefore(int pos) count -= toFree; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/TimSorter.cs b/src/Lucene.Net/Util/TimSorter.cs index bbc9525d8a..35553b3362 100644 --- a/src/Lucene.Net/Util/TimSorter.cs +++ b/src/Lucene.Net/Util/TimSorter.cs @@ -52,7 +52,7 @@ public abstract class TimSorter : Sorter internal int minRun; internal int to; internal int stackSize; - internal int[] runEnds; + internal readonly int[] runEnds; // LUCENENET: marked readonly /// /// Create a new . From 013f962c247a8d296bedb781889693034527a9e4 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Mon, 20 Jan 2025 08:17:33 -0700 Subject: [PATCH 3/6] Fix TestBufferedCharFilter.Test_Ready failing test, #1102 (#1104) --- .../Analysis/Util/TestBufferedCharFilter.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs index 739781047e..030ef86466 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestBufferedCharFilter.cs @@ -714,13 +714,13 @@ public void Test_ReadLine() * @tests java.io.BufferedReader#ready() */ [Test, LuceneNetSpecific] - [AwaitsFix(BugUrl = "https://github.com/apache/lucenenet/issues/1102")] // LUCENENET TODO: fix test public void Test_Ready() { // Test for method boolean java.io.BufferedReader.ready() try { - br = new BufferedCharFilter(new StringReader(testString)); + // LUCENENET specific: use TestStringReaderCharFilterAdapter to adapt StringReader to be IsReady-aware. + br = new BufferedCharFilter(new TestStringReaderCharFilterAdapter(new StringReader(testString))); assertTrue("IsReady returned false", br.IsReady); } catch (Exception e) when (e.IsIOException()) @@ -729,6 +729,30 @@ public void Test_Ready() } } + /// + /// LUCENENET specific class for to test that + /// cascades its call to the underlying + /// . Rationale: IsReady indicates that a call to + /// is guaranteed not to block. does not block, + /// because there is no I/O. Therefore, if the underlying reader is a , then + /// must return true. + /// + private class TestStringReaderCharFilterAdapter : CharFilter + { + public TestStringReaderCharFilterAdapter(StringReader input) // Enforces the input reader is a StringReader + : base(input) + { + } + + protected override int Correct(int currentOff) + => throw new NotImplementedException(); + + public override int Read(char[] buffer, int index, int count) + => m_input.Read(buffer, index, count); + + public override bool IsReady => true; // StringReaders do not block + } + /** * @tests java.io.BufferedReader#reset() */ From 2a0c97498e4bd77d98cedc990a4053fa0cde7d52 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Mon, 20 Jan 2025 22:33:44 +0700 Subject: [PATCH 4/6] PERFORMANCE: Lucene.Net.Replicator.LocalReplicator.ReplicationSession: Use J2N.Collections.Dictionary to allow deleting while iterating forward prior to .NET Core (fixes #1070). (#1108) --- src/Lucene.Net.Replicator/LocalReplicator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Lucene.Net.Replicator/LocalReplicator.cs b/src/Lucene.Net.Replicator/LocalReplicator.cs index 52f30e87ab..f66540b03e 100644 --- a/src/Lucene.Net.Replicator/LocalReplicator.cs +++ b/src/Lucene.Net.Replicator/LocalReplicator.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.IO; using System.Linq; +using JCG = J2N.Collections.Generic; namespace Lucene.Net.Replicator { @@ -132,14 +133,13 @@ public virtual void MarkAccessed() private volatile bool disposed = false; private readonly AtomicInt32 sessionToken = new AtomicInt32(0); - private readonly IDictionary sessions = new Dictionary(); + private readonly JCG.Dictionary sessions = new JCG.Dictionary(); /// private void CheckExpiredSessions() { - // .NET NOTE: .ToArray() so we don't modify a collection we are enumerating... - // I am wondering if it would be overall more practical to switch to a concurrent dictionary... - foreach (ReplicationSession token in sessions.Values.Where(token => token.IsExpired(ExpirationThreshold)).ToArray()) + // LUCENENET NOTE: JCG.Dictionary required for deleting while iterating forward prior to .NET Core + foreach (ReplicationSession token in sessions.Values.Where(token => token.IsExpired(ExpirationThreshold))) { ReleaseSession(token.Session.Id); } From 4acbde3007fbe661d4d6ba6843e25f190ded3b79 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Mon, 20 Jan 2025 22:34:53 +0700 Subject: [PATCH 5/6] Lucene.Net.Util.Events.TestPubSubEvent::CanAddSubscriptionWhileEventIsFiringNonGeneric(): Added [Ignore] attribute, as this only applies prior to .NET Standard 2.1 and was an inherited problem from Prism.Core. (#1107) --- src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs b/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs index c838b7d097..19a7f0d8ba 100644 --- a/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs +++ b/src/Lucene.Net.Tests/Support/Util/Events/TestPubSubEvent.cs @@ -436,7 +436,7 @@ public async Task ShouldNotExecuteOnGarbageCollectedFilterReferenceWhenNotKeepAl } [Test] - [Ignore("This test has been flakey since it was brought over from Prism")] + [Ignore("This test has been flakey since it was brought over from Prism (see https://github.com/apache/lucenenet/issues/998#issuecomment-2438994483)")] public void CanAddSubscriptionWhileEventIsFiring() { var PubSubEvent = new TestablePubSubEvent(); @@ -459,6 +459,7 @@ public void CanAddSubscriptionWhileEventIsFiring() } [Test] + [Ignore("This test has been flakey since it was brought over from Prism (see https://github.com/apache/lucenenet/issues/998#issuecomment-2438994483)")] public void CanAddSubscriptionWhileEventIsFiringNonGeneric() { var pubSubEvent = new TestablePubSubEvent(); @@ -710,4 +711,4 @@ public bool FilterString(string arg) } } -#endif \ No newline at end of file +#endif From ab73b083a064469e93408d9544bfb7576c512bd2 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Tue, 21 Jan 2025 09:01:19 -0700 Subject: [PATCH 6/6] BREAKING: Remove SystemConsole class, #920, #936 (#1113) * BREAKING: Remove SystemConsole class * Do not initialize debugStream to Console.Out, #936 * Remove unused code --- Directory.Build.targets | 2 - .../JapaneseTokenizer.cs | 2 +- .../Tools/DictionaryBuilder.cs | 1 - .../Tools/TokenInfoDictionaryBuilder.cs | 1 - .../Egothor.Stemmer/Compile.cs | 1 - .../Egothor.Stemmer/DiffIt.cs | 1 - src/Lucene.Net.Benchmark/ByTask/Benchmark.cs | 1 - .../ByTask/Feeds/ContentItemsSource.cs | 1 - .../ByTask/Feeds/EnwikiQueryMaker.cs | 1 - .../ByTask/Feeds/FileBasedQueryMaker.cs | 1 - .../ByTask/Feeds/ReutersQueryMaker.cs | 1 - .../ByTask/Feeds/SpatialDocMaker.cs | 5 +- .../ByTask/Feeds/TrecContentSource.cs | 1 - .../ByTask/PerfRunData.cs | 17 +- .../ByTask/Programmatic/Sample.cs | 2 +- .../ByTask/Tasks/CloseReaderTask.cs | 4 +- .../ByTask/Tasks/CloseTaxonomyReaderTask.cs | 2 +- .../ByTask/Tasks/CreateIndexTask.cs | 1 - .../ByTask/Tasks/NearRealtimeReaderTask.cs | 1 - .../ByTask/Tasks/NewCollationAnalyzerTask.cs | 3 +- .../ByTask/Tasks/NewLocaleTask.cs | 1 - .../ByTask/Tasks/PerfTask.cs | 9 +- .../ByTask/Tasks/PrintReaderTask.cs | 2 +- .../ByTask/Tasks/ReadTask.cs | 3 +- .../ByTask/Tasks/RepAllTask.cs | 2 +- .../ByTask/Tasks/RepSelectByPrefTask.cs | 1 - .../ByTask/Tasks/RepSumByNameRoundTask.cs | 4 +- .../ByTask/Tasks/RepSumByNameTask.cs | 4 +- .../ByTask/Tasks/RepSumByPrefRoundTask.cs | 3 +- .../ByTask/Tasks/RepSumByPrefTask.cs | 3 +- .../ByTask/Utils/Config.cs | 17 +- .../Quality/Trec/QueryDriver.cs | 1 - .../Quality/Utils/QualityQueriesFinder.cs | 1 - .../Support/TagSoup/XMLWriter.cs | 1 - .../Utils/ExtractReuters.cs | 1 - .../Utils/ExtractWikipedia.cs | 1 - .../Index/CompoundFileExtractor.cs | 1 - src/Lucene.Net.Misc/Index/IndexSplitter.cs | 1 - .../Index/MultiPassIndexSplitter.cs | 1 - src/Lucene.Net.Misc/Misc/GetTermInfo.cs | 1 - src/Lucene.Net.Misc/Misc/HighFreqTerms.cs | 1 - src/Lucene.Net.Misc/Misc/IndexMergeTool.cs | 1 - .../Classic/FastCharStream.cs | 1 - .../Classic/QueryParserTokenManager.cs | 17 +- .../StandardSyntaxParserTokenManager.cs | 14 +- .../Surround/Parser/FastCharStream.cs | 1 - .../Parser/QueryParserTokenManager.cs | 16 +- .../Analysis/BaseTokenStreamTestCase.cs | 1 - .../Analysis/LookaheadTokenFilter.cs | 5 +- .../Analysis/MockAnalyzer.cs | 3 +- .../Analysis/MockGraphTokenFilter.cs | 3 +- .../MockRandomLookaheadTokenFilter.cs | 3 +- .../Analysis/TokenStreamToDot.cs | 3 +- .../Lucene3x/PreFlexRWPostingsFormat.cs | 2 +- .../MockRandom/MockRandomPostingsFormat.cs | 1 - .../Index/BasePostingsFormatTestCase.cs | 1 - .../Index/BaseStoredFieldsFormatTestCase.cs | 3 +- .../Index/RandomCodec.cs | 31 +- .../Index/RandomIndexWriter.cs | 1 - .../ThreadedIndexingAndSearchingTestCase.cs | 1 - .../Search/ShardSearchingTestBase.cs | 1 - .../Store/MockDirectoryWrapper.cs | 1 - .../Store/MockIndexOutputWrapper.cs | 1 - .../Support/ApiScanTestBase.cs | 1 - .../Util/LuceneTestFrameworkInitializer.cs | 4 - .../Util/Fst/FSTTester.cs | 1 - .../Util/LineFileDocs.cs | 1 - .../Util/LuceneTestCase.cs | 19 +- .../Util/TestRuleSetupAndRestoreClassEnv.cs | 19 +- src/Lucene.Net.TestFramework/Util/TestUtil.cs | 1 - .../CharFilters/TestMappingCharFilter.cs | 5 +- .../Analysis/Core/TestBugInSomething.cs | 5 +- .../Analysis/Core/TestRandomChains.cs | 1 - .../Analysis/Core/TestStopFilter.cs | 1 - .../Analysis/Core/TestTypeTokenFilter.cs | 6 +- .../Analysis/Hunspell/TestAllDictionaries.cs | 9 +- .../Analysis/Hunspell/TestAllDictionaries2.cs | 7 +- .../Pattern/TestPatternReplaceCharFilter.cs | 5 +- .../Analysis/Sinks/TestTeeSinkTokenFilter.cs | 5 +- .../Analysis/Snowball/TestSnowballVocab.cs | 8 +- .../Analysis/Synonym/TestSynonymMapFilter.cs | 1 - .../Analysis/Util/TestRollingCharBuffer.cs | 8 +- .../Icu/Segmentation/TestICUTokenizer.cs | 6 +- .../Dict/TestTokenInfoDictionary.cs | 1 - .../TestJapaneseTokenizer.cs | 1 - .../TestSearchMode.cs | 1 - .../Bm/CacheSubSequencePerformanceTest.cs | 2 +- .../Bm/PhoneticEnginePerformanceTest.cs | 2 +- .../BenchmarkTestCase.cs | 1 - .../ByTask/Tasks/CreateIndexTaskTest.cs | 9 +- src/Lucene.Net.Tests.Facet/FacetTestCase.cs | 7 +- .../Range/TestRangeFacetCounts.cs | 1 - .../SortedSet/TestSortedSetDocValuesFacets.cs | 3 +- .../TestConcurrentFacetedIndexing.cs | 1 - .../Directory/TestDirectoryTaxonomyWriter.cs | 1 - .../Taxonomy/TestSearcherTaxonomyManager.cs | 5 +- .../Taxonomy/TestTaxonomyFacetCounts.cs | 1 - .../TestTaxonomyFacetSumValueSource.cs | 1 - .../WriterCache/TestCompactLabelToOrdinal.cs | 1 - .../TestDrillSideways.cs | 1 - .../AllGroupHeadsCollectorTest.cs | 1 - .../AllGroupsCollectorTest.cs | 1 - .../DistinctValuesCollectorTest.cs | 1 - .../GroupFacetCollectorTest.cs | 3 +- src/Lucene.Net.Tests.Grouping/TestGrouping.cs | 7 +- .../Custom/HighlightCustomQueryTest.cs | 1 - .../Highlight/HighlighterTest.cs | 1 - .../SimpleFragListBuilderTest.cs | 1 - .../Support/TestBlockJoin.cs | 1 - .../Support/TestJoinUtil.cs | 1 - src/Lucene.Net.Tests.Join/TestBlockJoin.cs | 1 - src/Lucene.Net.Tests.Join/TestJoinUtil.cs | 1 - .../Index/Memory/MemoryIndexTest.cs | 1 - .../Document/TestLazyDocument.cs | 1 - .../Index/Sorter/IndexSortingTest.cs | 1 - .../Index/Sorter/SorterTestBase.cs | 1 - .../Index/Sorter/SortingAtomicReaderTest.cs | 1 - .../Util/Fst/TestFSTsMisc.cs | 3 +- .../Function/FunctionTestSetup.cs | 1 - .../Spans/TestSpanQueryParserSimpleSample.cs | 7 +- .../Standard/TestNumericQueryParser.cs | 1 - .../Flexible/Standard/TestQPHelper.cs | 1 - .../Standard/Config/TestNumberDateFormat.cs | 1 - .../Surround/Query/BooleanQueryTst.cs | 2 +- .../Surround/Query/ExceptionQueryTst.cs | 1 - .../Util/QueryParserTestBase.cs | 1 - .../Xml/TestParser.cs | 1 - .../IndexAndTaxonomyReplicationClientTest.cs | 1 - .../IndexReplicationClientTest.cs | 1 - .../Queries/TestSlowFuzzyQuery2.cs | 17 +- .../Prefix/NtsPolygonTest.cs | 1 - .../SpatialOpRecursivePrefixTreeTest.cs | 1 - .../Prefix/Tree/SpatialPrefixTreeTest.cs | 1 - .../Spell/TestSpellChecker.cs | 1 - .../Analyzing/AnalyzingInfixSuggesterTest.cs | 5 +- .../Analyzing/AnalyzingSuggesterTest.cs | 11 +- .../Analyzing/BlendedInfixSuggesterTest.cs | 3 +- .../Suggest/Analyzing/FuzzySuggesterTest.cs | 19 +- .../Analyzing/TestFreeTextSuggester.cs | 3 +- .../Suggest/Fst/FSTCompletionTest.cs | 9 +- .../Suggest/Fst/LargeInputFST.cs | 1 - .../Suggest/LookupBenchmarkTest.cs | 1 - .../Analysis/TestGraphTokenizers.cs | 1 - .../Codecs/Lucene3x/TestSurrogates.cs | 1 - .../PerField/TestPerFieldPostingsFormat2.cs | 1 - .../Index/Test2BBinaryDocValues.cs | 1 - .../Index/Test2BNumericDocValues.cs | 1 - src/Lucene.Net.Tests/Index/Test2BPositions.cs | 1 - src/Lucene.Net.Tests/Index/Test2BPostings.cs | 1 - .../Index/Test2BSortedDocValues.cs | 1 - src/Lucene.Net.Tests/Index/Test2BTerms.cs | 1 - .../Index/Test4GBStoredFields.cs | 1 - src/Lucene.Net.Tests/Index/TestAddIndexes.cs | 1 - .../Index/TestAtomicUpdate.cs | 1 - .../Index/TestBackwardsCompatibility.cs | 1 - .../Index/TestBackwardsCompatibility3x.cs | 1 - .../Index/TestBagOfPositions.cs | 1 - .../Index/TestBagOfPostings.cs | 1 - .../Index/TestBinaryDocValuesUpdates.cs | 1 - src/Lucene.Net.Tests/Index/TestByteSlices.cs | 2 +- src/Lucene.Net.Tests/Index/TestCheckIndex.cs | 2 +- src/Lucene.Net.Tests/Index/TestCodecs.cs | 1 - .../Index/TestConcurrentMergeScheduler.cs | 1 - src/Lucene.Net.Tests/Index/TestCrash.cs | 1 - .../Index/TestCrashCausesCorruptIndex.cs | 1 - .../Index/TestDeletionPolicy.cs | 1 - .../Index/TestDirectoryReader.cs | 1 - .../Index/TestDirectoryReaderReopen.cs | 1 - src/Lucene.Net.Tests/Index/TestDoc.cs | 1 - src/Lucene.Net.Tests/Index/TestDocTermOrds.cs | 1 - .../Index/TestDocValuesWithThreads.cs | 1 - .../Index/TestDocumentsWriterStallControl.cs | 1 - .../Index/TestFlushByRamOrCountsPolicy.cs | 1 - .../Index/TestForceMergeForever.cs | 1 - src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 1 - .../Index/TestIndexWriterCommit.cs | 1 - .../Index/TestIndexWriterDelete.cs | 1 - .../Index/TestIndexWriterExceptions.cs | 1 - .../Index/TestIndexWriterForceMerge.cs | 2 +- .../Index/TestIndexWriterMerging.cs | 1 - .../Index/TestIndexWriterNRTIsCurrent.cs | 1 - .../Index/TestIndexWriterOnDiskFull.cs | 1 - .../Index/TestIndexWriterOnJRECrash.cs | 1 - .../TestIndexWriterOutOfFileDescriptors.cs | 1 - .../Index/TestIndexWriterReader.cs | 1 - .../Index/TestIndexWriterWithThreads.cs | 1 - .../Index/TestIndexableField.cs | 1 - .../Index/TestLongPostings.cs | 1 - src/Lucene.Net.Tests/Index/TestMixedCodecs.cs | 1 - src/Lucene.Net.Tests/Index/TestMultiFields.cs | 2 +- .../Index/TestNRTReaderWithThreads.cs | 1 - src/Lucene.Net.Tests/Index/TestNRTThreads.cs | 2 +- src/Lucene.Net.Tests/Index/TestNeverDelete.cs | 1 - .../Index/TestParallelReaderEmptyIndex.cs | 2 +- .../Index/TestPerSegmentDeletes.cs | 1 - .../Index/TestRollingUpdates.cs | 1 - .../Index/TestSnapshotDeletionPolicy.cs | 1 - .../Index/TestStressAdvance.cs | 1 - .../Index/TestStressIndexing.cs | 1 - .../Index/TestStressIndexing2.cs | 1 - src/Lucene.Net.Tests/Index/TestStressNRT.cs | 1 - src/Lucene.Net.Tests/Index/TestSumDocFreq.cs | 2 +- src/Lucene.Net.Tests/Index/TestTermdocPerf.cs | 1 - src/Lucene.Net.Tests/Index/TestTermsEnum.cs | 1 - .../Index/TestThreadedForceMerge.cs | 1 - .../Index/TestTieredMergePolicy.cs | 3 +- .../Index/TestTransactions.cs | 1 - .../Search/Payloads/TestPayloadNearQuery.cs | 1 - .../Search/Spans/TestPayloadSpans.cs | 1 - .../Search/Spans/TestSpansAdvanced.cs | 1 - .../Search/TestAutomatonQuery.cs | 2 +- src/Lucene.Net.Tests/Search/TestBoolean2.cs | 1 - .../Search/TestBooleanMinShouldMatch.cs | 1 - .../Search/TestBooleanQuery.cs | 1 - .../TestControlledRealTimeReopenThread.cs | 1 - .../Search/TestCustomSearcherSort.cs | 1 - .../Search/TestDisjunctionMaxQuery.cs | 1 - src/Lucene.Net.Tests/Search/TestDocBoost.cs | 2 +- src/Lucene.Net.Tests/Search/TestDocIdSet.cs | 1 - .../Search/TestDocTermOrdsRangeFilter.cs | 1 - .../Search/TestDocTermOrdsRewriteMethod.cs | 1 - src/Lucene.Net.Tests/Search/TestFieldCache.cs | 1 - .../Search/TestLiveFieldValues.cs | 1 - .../Search/TestMultiPhraseQuery.cs | 1 - .../Search/TestMultiTermConstantScore.cs | 1 - .../Search/TestMultiTermQueryRewrites.cs | 1 - .../Search/TestMultiThreadTermVectors.cs | 1 - .../Search/TestNumericRangeQuery32.cs | 1 - .../Search/TestNumericRangeQuery64.cs | 1 - .../Search/TestPositionIncrement.cs | 1 - .../Search/TestRegexpRandom2.cs | 1 - src/Lucene.Net.Tests/Search/TestScorerPerf.cs | 1 - .../Search/TestSearchAfter.cs | 1 - .../Search/TestSearchWithThreads.cs | 1 - .../Search/TestSearcherManager.cs | 1 - .../Search/TestShardSearching.cs | 2 +- src/Lucene.Net.Tests/Search/TestSortRandom.cs | 1 - .../Search/TestTimeLimitingCollector.cs | 1 - .../Search/TestTopDocsMerge.cs | 1 - src/Lucene.Net.Tests/Search/TestWildcard.cs | 2 +- .../Search/TestWildcardRandom.cs | 2 +- src/Lucene.Net.Tests/Store/TestCopyBytes.cs | 1 - src/Lucene.Net.Tests/Store/TestDirectory.cs | 1 - src/Lucene.Net.Tests/Store/TestLockFactory.cs | 1 - .../Store/TestNRTCachingDirectory.cs | 1 - .../Support/Threading/ReentrantLockTest.cs | 1 - src/Lucene.Net.Tests/TestExternalCodecs.cs | 1 - .../TestMergeSchedulerExternal.cs | 1 - src/Lucene.Net.Tests/TestSearch.cs | 1 - .../TestSearchForDuplicates.cs | 1 - .../TestWorstCaseTestBehavior.cs | 1 - .../Util/Automaton/TestBasicOperations.cs | 1 - .../Util/Automaton/TestCompiledAutomaton.cs | 1 - .../Util/Automaton/TestUTF32ToUTF8.cs | 1 - src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs | 1 - .../Util/Fst/TestBytesStore.cs | 1 - src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs | 1 - .../Util/Packed/TestPackedInts.cs | 1 - .../Util/StressRamUsageEstimator.cs | 1 - src/Lucene.Net.Tests/Util/TestArrayUtil.cs | 1 - src/Lucene.Net.Tests/Util/TestConstants.cs | 1 - .../Util/TestFieldCacheSanityChecker.cs | 2 +- .../Util/TestPriorityQueue.cs | 1 - .../Util/TestRollingBuffer.cs | 1 - src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs | 1 - .../Codecs/Lucene3x/Lucene3xFields.cs | 7 +- src/Lucene.Net/Index/CheckIndex.cs | 1 - src/Lucene.Net/Index/IndexUpgrader.cs | 1 - src/Lucene.Net/Store/LockStressTest.cs | 1 - src/Lucene.Net/Store/LockVerifyServer.cs | 1 - src/Lucene.Net/Store/NRTCachingDirectory.cs | 5 +- src/Lucene.Net/Support/Util/SystemConsole.cs | 411 ------------------ src/Lucene.Net/Util/PrintStreamInfoStream.cs | 3 +- .../CommandLine/CommandLineApplication.cs | 3 +- src/dotnet/tools/lucene-cli/Program.cs | 4 - 275 files changed, 191 insertions(+), 874 deletions(-) delete mode 100644 src/Lucene.Net/Support/Util/SystemConsole.cs diff --git a/Directory.Build.targets b/Directory.Build.targets index 60014e02b9..d08b29eb3e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -64,7 +64,6 @@ - $(DefineConstants);FEATURE_ARGITERATOR $(DefineConstants);FEATURE_PROCESS_KILL_ENTIREPROCESSTREE $(DefineConstants);FEATURE_STRING_CONCAT_READONLYSPAN @@ -144,7 +143,6 @@ $(DefineConstants);NETFRAMEWORK - $(DefineConstants);FEATURE_ARGITERATOR $(DefineConstants);FEATURE_CODE_ACCESS_SECURITY diff --git a/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs b/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs index edf76facd7..e085f25d34 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/JapaneseTokenizer.cs @@ -9,11 +9,11 @@ using Lucene.Net.Support; using Lucene.Net.Util; using Lucene.Net.Util.Fst; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; using Int64 = J2N.Numerics.Int64; diff --git a/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs b/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs index 19a5abbb65..34a61984e5 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs @@ -1,6 +1,5 @@ using Lucene.Net.Util; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Ja.Util { diff --git a/src/Lucene.Net.Analysis.Kuromoji/Tools/TokenInfoDictionaryBuilder.cs b/src/Lucene.Net.Analysis.Kuromoji/Tools/TokenInfoDictionaryBuilder.cs index 7e0df4ad7f..7c00a113c7 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Tools/TokenInfoDictionaryBuilder.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/Tools/TokenInfoDictionaryBuilder.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; using Int64 = J2N.Numerics.Int64; diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs index d7790b475d..82d2bbf3e0 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; /* diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs index f1053e94af..1f0dea5be1 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs @@ -3,7 +3,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using Integer = J2N.Numerics.Int32; using JCG = J2N.Collections.Generic; diff --git a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs index dae4477cf4..491d3d8023 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs @@ -4,7 +4,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask { diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/ContentItemsSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/ContentItemsSource.cs index 4b50076cdf..6347080c35 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/ContentItemsSource.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/ContentItemsSource.cs @@ -7,7 +7,6 @@ using System.IO; using System.Reflection; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Feeds { diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs index fa709819b9..c82a61edf7 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/EnwikiQueryMaker.cs @@ -9,7 +9,6 @@ using Lucene.Net.Util; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Feeds diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs index bbbdf3a671..8dcc8b5c05 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs @@ -7,7 +7,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Feeds diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs index e6c7df4605..c1d55c5c9f 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs @@ -7,7 +7,6 @@ using Lucene.Net.Util; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Feeds diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs index c4eea771b0..0bf07c5efd 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/SpatialDocMaker.cs @@ -8,7 +8,6 @@ using System; using System.Collections; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Feeds { @@ -126,12 +125,12 @@ public bool ContainsKey(string key) void ICollection>.Add(KeyValuePair item) => throw UnsupportedOperationException.Create(); void ICollection>.Clear() => throw UnsupportedOperationException.Create(); bool ICollection>.Contains(KeyValuePair item) => throw UnsupportedOperationException.Create(); - + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => throw UnsupportedOperationException.Create(); IEnumerator> IEnumerable>.GetEnumerator() => throw UnsupportedOperationException.Create(); bool IDictionary.Remove(string key) => throw UnsupportedOperationException.Create(); bool ICollection>.Remove(KeyValuePair item) => throw UnsupportedOperationException.Create(); - + IEnumerator IEnumerable.GetEnumerator() => throw UnsupportedOperationException.Create(); #endregion IDictionary members diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs index 4db0cd4fce..0e2a24788c 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/TrecContentSource.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Feeds diff --git a/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs b/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs index a06949ccec..0e2c851e0e 100644 --- a/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs +++ b/src/Lucene.Net.Benchmark/ByTask/PerfRunData.cs @@ -14,7 +14,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask @@ -103,7 +102,7 @@ public PerfRunData(Config config) : this( config, performReinit: true, logQueries: string.Equals(config?.Get("log.queries", "false") ?? "false", "true", StringComparison.OrdinalIgnoreCase)) - { + { } // LUCENENET specific - added performReinit parameter to allow subclasses to skip reinit @@ -114,7 +113,7 @@ public PerfRunData(Config config) : this( protected PerfRunData(Config config, bool performReinit, bool logQueries) { this.config = config ?? throw new ArgumentNullException(nameof(config)); - + // analyzer (default is standard analyzer) analyzer = NewAnalyzerTask.CreateAnalyzer(config.Get("analyzer", typeof(Lucene.Net.Analysis.Standard.StandardAnalyzer).AssemblyQualifiedName)); @@ -178,7 +177,7 @@ protected virtual void Dispose(bool disposing) } } - // clean old stuff, reopen + // clean old stuff, reopen public virtual void Reinit(bool eraseIndex) { // cleanup index @@ -290,9 +289,9 @@ public virtual Store.Directory Directory /// /// Set the taxonomy reader. Takes ownership of that taxonomy reader, that is, - /// internally performs taxoReader.IncRef() (If caller no longer needs that - /// reader it should DecRef()/Dispose() it after calling this method, otherwise, - /// the reader will remain open). + /// internally performs taxoReader.IncRef() (If caller no longer needs that + /// reader it should DecRef()/Dispose() it after calling this method, otherwise, + /// the reader will remain open). /// /// The taxonomy reader to set. public virtual void SetTaxonomyReader(TaxonomyReader taxoReader) @@ -399,9 +398,9 @@ public virtual IndexSearcher GetIndexSearcher() /// /// Set the index reader. Takes ownership of that index reader, that is, - /// internally performs indexReader.incRef() (If caller no longer needs that + /// internally performs indexReader.incRef() (If caller no longer needs that /// reader it should decRef()/close() it after calling this method, otherwise, - /// the reader will remain open). + /// the reader will remain open). /// /// The indexReader to set. public virtual void SetIndexReader(DirectoryReader indexReader) diff --git a/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs b/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs index 1e7500faa8..0e24b8f7db 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs @@ -1,7 +1,7 @@ using Lucene.Net.Benchmarks.ByTask.Tasks; using Lucene.Net.Benchmarks.ByTask.Utils; +using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Programmatic { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseReaderTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseReaderTask.cs index 3d7e104aa8..8bcf909341 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseReaderTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseReaderTask.cs @@ -1,5 +1,5 @@ using Lucene.Net.Index; -using Console = Lucene.Net.Util.SystemConsole; +using System; namespace Lucene.Net.Benchmarks.ByTask.Tasks { @@ -25,7 +25,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks /// /// Other side effects: index reader in perfRunData is nullified. /// - /// This would cause read related tasks to reopen their own reader. + /// This would cause read related tasks to reopen their own reader. /// public class CloseReaderTask : PerfTask { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseTaxonomyReaderTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseTaxonomyReaderTask.cs index 7e8c98f84d..ff09f62067 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseTaxonomyReaderTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/CloseTaxonomyReaderTask.cs @@ -1,5 +1,5 @@ using Lucene.Net.Facet.Taxonomy; -using Console = Lucene.Net.Util.SystemConsole; +using System; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs index 1e8ed83362..bfa3ddcb00 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs @@ -5,7 +5,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NearRealtimeReaderTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NearRealtimeReaderTask.cs index f4b5178b07..dd6bf5fd8b 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NearRealtimeReaderTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NearRealtimeReaderTask.cs @@ -4,7 +4,6 @@ using System; using System.Globalization; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewCollationAnalyzerTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewCollationAnalyzerTask.cs index d7cbfc7203..160f6e0dfc 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewCollationAnalyzerTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewCollationAnalyzerTask.cs @@ -4,7 +4,6 @@ using Lucene.Net.Util; using System; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { @@ -62,7 +61,7 @@ public static Type GetCollatorType(this NewCollationAnalyzerTask.Implementation public class NewCollationAnalyzerTask : PerfTask { /// - /// Different Collation implementations: currently + /// Different Collation implementations: currently /// limited to what is provided in ICU. /// /// See Comparison of implementations diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewLocaleTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewLocaleTask.cs index db6d24ee42..20e6b57c81 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/NewLocaleTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/NewLocaleTask.cs @@ -1,7 +1,6 @@ using J2N.Text; using System; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs index 373c1884ad..6b4e0c2b56 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/PerfTask.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Text; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { @@ -145,7 +144,7 @@ protected PerfTask(PerfRunData runData) public virtual object Clone() { // tasks having non primitive data structures should override this. - // otherwise parallel running of a task sequence might not run correctly. + // otherwise parallel running of a task sequence might not run correctly. return (PerfTask)base.MemberwiseClone(); } @@ -233,7 +232,7 @@ public virtual int Depth set => depth = value; } - // compute a blank string padding for printing this task indented by its depth + // compute a blank string padding for printing this task indented by its depth internal string GetPadding() { char[] c = new char[4 * Depth]; @@ -279,7 +278,7 @@ protected virtual string GetLogMessage(int recsCount) protected virtual bool ShouldNeverLogAtStart => false; /// - /// Tasks that should not record statistics can override this. + /// Tasks that should not record statistics can override this. /// Returns true if this task should never record its statistics. /// protected virtual bool ShouldNotRecordStats => false; @@ -301,7 +300,7 @@ public virtual void Setup() /// default it does nothing, but tasks can implement this, moving work from /// to this method. Only the work done in /// is measured for this task. Notice that higher level (sequence) tasks - /// containing this task would then measure larger time than the sum of their + /// containing this task would then measure larger time than the sum of their /// contained tasks. /// public virtual void TearDown() diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/PrintReaderTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/PrintReaderTask.cs index 1aab50f387..09416058a3 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/PrintReaderTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/PrintReaderTask.cs @@ -1,6 +1,6 @@ using Lucene.Net.Index; using Lucene.Net.Store; -using Console = Lucene.Net.Util.SystemConsole; +using System; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/ReadTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/ReadTask.cs index 446c113138..12a5f3097f 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/ReadTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/ReadTask.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using System.Diagnostics.CodeAnalysis; namespace Lucene.Net.Benchmarks.ByTask.Tasks @@ -51,7 +50,7 @@ public abstract class ReadTask : PerfTask private readonly IQueryMaker? queryMaker; [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] - [SuppressMessage("CodeQuality", "S1699:Constructors should only call non-overridable methods", Justification = "Required for continuity with Lucene's design")] + [SuppressMessage("CodeQuality", "S1699:Constructors should only call non-overridable methods", Justification = "Required for continuity with Lucene's design")] protected ReadTask(PerfRunData runData) // LUCENENET: CA1012: Abstract types should not have constructors (marked protected) : this(runData, queryMaker: null) { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepAllTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepAllTask.cs index 7fe436c023..9365efb10f 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepAllTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepAllTask.cs @@ -1,7 +1,7 @@ using Lucene.Net.Benchmarks.ByTask.Stats; +using System; using System.Collections.Generic; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSelectByPrefTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSelectByPrefTask.cs index f9ec882ed1..667f204a29 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSelectByPrefTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSelectByPrefTask.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs index e7b8b2ffdf..766aa9e00a 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs @@ -1,6 +1,6 @@ using Lucene.Net.Benchmarks.ByTask.Stats; +using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Tasks @@ -76,7 +76,7 @@ protected virtual Report ReportSumByNameRound(IList taskStats) } } } - // now generate report from secondary list p2 + // now generate report from secondary list p2 return GenPartialReport(reported, p2, taskStats.Count); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs index cef9d66323..d346f29ded 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs @@ -1,6 +1,6 @@ using Lucene.Net.Benchmarks.ByTask.Stats; +using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Tasks @@ -74,7 +74,7 @@ protected virtual Report ReportSumByName(IList taskStats) } } } - // now generate report from secondary list p2 + // now generate report from secondary list p2 return GenPartialReport(reported, p2, taskStats.Count); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs index a4bbf9e8f8..117ac103b0 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs @@ -1,7 +1,6 @@ using Lucene.Net.Benchmarks.ByTask.Stats; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Tasks @@ -72,7 +71,7 @@ protected virtual Report ReportSumByPrefixRound(IList taskStats) } } } - // now generate report from secondary list p2 + // now generate report from secondary list p2 return GenPartialReport(reported, p2, taskStats.Count); } } diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs index a3317afbe2..c0184b784a 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs @@ -1,7 +1,6 @@ using Lucene.Net.Benchmarks.ByTask.Stats; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Tasks @@ -72,7 +71,7 @@ protected virtual Report ReportSumByPrefix(IList taskStats) } } } - // now generate report from secondary list p2 + // now generate report from secondary list p2 return GenPartialReport(reported, p2, taskStats.Count); } diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs index 1acc6f1e0c..391f904d2e 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Config.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.ByTask.Utils @@ -90,7 +89,7 @@ public Config(TextReader algReader) ms.Position = 0; props.LoadProperties(ms); - // make sure work dir is set properly + // make sure work dir is set properly if (!props.TryGetValue("work.dir", out string temp) || temp is null) { // LUCENENET specific - reformatted with : @@ -229,7 +228,7 @@ public virtual int Get(string name, int dflt) vals = (int[])temp; return vals[roundNumber % vals.Length]; } - // done if not by round + // done if not by round if (!props.TryGetValue(name, out string sval)) { sval = dflt.ToString(CultureInfo.InvariantCulture); @@ -267,7 +266,7 @@ public virtual double Get(string name, double dflt) vals = (double[])temp; return vals[roundNumber % vals.Length]; } - // done if not by round + // done if not by round if (!props.TryGetValue(name, out string sval)) { sval = dflt.ToString(CultureInfo.InvariantCulture); @@ -304,7 +303,7 @@ public virtual bool Get(string name, bool dflt) vals = (bool[])temp; return vals[roundNumber % vals.Length]; } - // done if not by round + // done if not by round if (!props.TryGetValue(name, out string sval)) { sval = dflt.ToString(); // LUCENENET NOTE: bool ignores the IFormatProvider argument, it returns the values of constants @@ -313,7 +312,7 @@ public virtual bool Get(string name, bool dflt) { return bool.Parse(sval); } - // first time this prop is extracted by round + // first time this prop is extracted by round int k = sval.IndexOf(':'); string colName = sval.Substring(0, k - 0); sval = sval.Substring(k + 1); @@ -392,7 +391,7 @@ private static string[] PropToStringArray(string s) // LUCENENET: CA1822: Mark m return a.ToArray(); } - // extract properties to array, e.g. for "10:100:5" return int[]{10,100,5}. + // extract properties to array, e.g. for "10:100:5" return int[]{10,100,5}. private static int[] PropToInt32Array(string s) // LUCENENET: CA1822: Mark members as static { if (s.IndexOf(':') < 0) @@ -415,7 +414,7 @@ private static int[] PropToInt32Array(string s) // LUCENENET: CA1822: Mark membe return res; } - // extract properties to array, e.g. for "10.7:100.4:-2.3" return int[]{10.7,100.4,-2.3}. + // extract properties to array, e.g. for "10.7:100.4:-2.3" return int[]{10.7,100.4,-2.3}. private static double[] PropToDoubleArray(string s) // LUCENENET: CA1822: Mark members as static { if (s.IndexOf(':') < 0) @@ -438,7 +437,7 @@ private static double[] PropToDoubleArray(string s) // LUCENENET: CA1822: Mark m return res; } - // extract properties to array, e.g. for "true:true:false" return boolean[]{true,false,false}. + // extract properties to array, e.g. for "true:true:false" return boolean[]{true,false,false}. private static bool[] PropToBooleanArray(string s) // LUCENENET: CA1822: Mark members as static { if (s.IndexOf(':') < 0) diff --git a/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs b/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs index a223653dc9..3a349e9913 100644 --- a/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs +++ b/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Benchmarks.Quality.Trec diff --git a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs index 98bd9ec694..d6eab97f43 100644 --- a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs +++ b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs @@ -3,7 +3,6 @@ using Lucene.Net.Util; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.Quality.Utils { diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs index 9e77f92b70..a64bef8553 100644 --- a/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs +++ b/src/Lucene.Net.Benchmark/Support/TagSoup/XMLWriter.cs @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace TagSoup { diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs index 8d04403261..04a5e0eb0f 100644 --- a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs +++ b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs @@ -3,7 +3,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.Utils { diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs b/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs index 7a50f3fb5f..08e0e0fc90 100644 --- a/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs +++ b/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.Utils { diff --git a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs index bfd6dc7343..9b5684a649 100644 --- a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs +++ b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs @@ -2,7 +2,6 @@ using Lucene.Net.Util; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Misc/Index/IndexSplitter.cs b/src/Lucene.Net.Misc/Index/IndexSplitter.cs index f3a06c8a39..4122fdda17 100644 --- a/src/Lucene.Net.Misc/Index/IndexSplitter.cs +++ b/src/Lucene.Net.Misc/Index/IndexSplitter.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs index a0495b7e2e..b58bb92220 100644 --- a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs +++ b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs index a5caf8d698..7f77f662ac 100644 --- a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs +++ b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs @@ -2,7 +2,6 @@ using Lucene.Net.Store; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Misc { diff --git a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs index afc30f40c4..07dd53acd8 100644 --- a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs +++ b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Misc { diff --git a/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs b/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs index 21496dfda3..4cbea1dfab 100644 --- a/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs +++ b/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs @@ -2,7 +2,6 @@ using Lucene.Net.Store; using Lucene.Net.Util; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Misc { diff --git a/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs b/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs index 4ae016b04c..bae6a213af 100644 --- a/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs +++ b/src/Lucene.Net.QueryParser/Classic/FastCharStream.cs @@ -1,7 +1,6 @@ using Lucene.Net.Support; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Classic { diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs index 19a89ae908..d1018e3d81 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs @@ -1,8 +1,5 @@ -using Lucene.Net.Support.IO; -using System; +using System; using System.Diagnostics.CodeAnalysis; -using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Classic { @@ -29,15 +26,9 @@ namespace Lucene.Net.QueryParsers.Classic [SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "This class is based on generated code")] public class QueryParserTokenManager //: QueryParserConstants { - /// Debug output. -#pragma warning disable IDE0052 // Remove unread private members - private TextWriter debugStream = Console.Out; // LUCENENET specific - made private, since we already have a setter -#pragma warning restore IDE0052 // Remove unread private members - /// Set debug output. - public virtual void SetDebugStream(TextWriter ds) - { - debugStream = new SafeTextWriterWrapper(ds); - } + /** Debug output. */ + // LUCENENET: debugStream/SetDebugStream() omitted, since it is unused and has been omitted in later versions of Lucene + private int JjStopStringLiteralDfa_2(int pos, long active0) { switch (pos) diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs index 11d1819f74..abfc5f5cb3 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParserTokenManager.cs @@ -1,8 +1,5 @@ -using Lucene.Net.Support.IO; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System; -using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser { @@ -30,12 +27,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Parser [SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "This class is based on generated code")] public class StandardSyntaxParserTokenManager /*: StandardSyntaxParserConstants*/ { - /// Debug output. -#pragma warning disable IDE0052 // Remove unread private members - private TextWriter debugStream = Console.Out; // LUCENENET specific - made private, since we already have a setter -#pragma warning restore IDE0052 // Remove unread private members - /// Set debug output. - public void SetDebugStream(TextWriter ds) { debugStream = new SafeTextWriterWrapper(ds); } + /** Debug output. */ + // LUCENENET: debugStream/SetDebugStream() omitted, since it is unused and has been omitted in later versions of Lucene + private int JjStopStringLiteralDfa_2(int pos, long active0) { switch (pos) diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs b/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs index 77ef1f4e1b..b83e3a3d76 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/FastCharStream.cs @@ -1,7 +1,6 @@ using Lucene.Net.Support; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Surround.Parser { diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs index 67029431a8..ff748fdcaa 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParserTokenManager.cs @@ -1,7 +1,5 @@ -using Lucene.Net.Support.IO; -using System; +using System; using System.Diagnostics.CodeAnalysis; -using System.IO; namespace Lucene.Net.QueryParsers.Surround.Parser { @@ -31,15 +29,9 @@ namespace Lucene.Net.QueryParsers.Surround.Parser [SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "This class is based on generated code")] public class QueryParserTokenManager //: QueryParserConstants { - /// Debug output. -#pragma warning disable IDE0052 // Remove unread private members - private TextWriter debugStream; // LUCENENET specific - made private, since we already have a setter -#pragma warning restore IDE0052 // Remove unread private members - /// Set debug output. - public virtual void SetDebugStream(TextWriter ds) - { - debugStream = new SafeTextWriterWrapper(ds); - } + /** Debug output. */ + // LUCENENET: debugStream/SetDebugStream() omitted, since it is unused and has been omitted in later versions of Lucene + private int JjStopStringLiteralDfa_1(int pos, long active0) { switch (pos) diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs index 67a4c892eb..319c204345 100644 --- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs +++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs @@ -16,7 +16,6 @@ using Assert = Lucene.Net.TestFramework.Assert; using Attribute = Lucene.Net.Util.Attribute; using AttributeFactory = Lucene.Net.Util.AttributeSource.AttributeFactory; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using JCG = J2N.Collections.Generic; diff --git a/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs index e8b241f025..e50356897b 100644 --- a/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs +++ b/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs @@ -3,7 +3,6 @@ using Lucene.Net.Util; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Analysis @@ -95,7 +94,7 @@ public virtual AttributeSource.State NextState() public abstract class LookaheadTokenFilter : LookaheadTokenFilter where T : LookaheadTokenFilter.Position { - protected readonly static bool DEBUG = + protected readonly static bool DEBUG = #if VERBOSE_TEST_LOGGING true #else @@ -377,4 +376,4 @@ public override void Reset() m_end = false; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Analysis/MockAnalyzer.cs b/src/Lucene.Net.TestFramework/Analysis/MockAnalyzer.cs index 952eb3a6fa..0d8c1489bc 100644 --- a/src/Lucene.Net.TestFramework/Analysis/MockAnalyzer.cs +++ b/src/Lucene.Net.TestFramework/Analysis/MockAnalyzer.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis { @@ -207,4 +206,4 @@ public int MaxTokenLength set => maxTokenLength = value; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs index e52443d75d..cb05f37560 100644 --- a/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs +++ b/src/Lucene.Net.TestFramework/Analysis/MockGraphTokenFilter.cs @@ -2,7 +2,6 @@ using Lucene.Net.Util; using RandomizedTesting.Generators; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis { @@ -133,4 +132,4 @@ public override bool IncrementToken() return NextToken(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Analysis/MockRandomLookaheadTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/MockRandomLookaheadTokenFilter.cs index f979cc8afa..4b77b7b4c6 100644 --- a/src/Lucene.Net.TestFramework/Analysis/MockRandomLookaheadTokenFilter.cs +++ b/src/Lucene.Net.TestFramework/Analysis/MockRandomLookaheadTokenFilter.cs @@ -3,7 +3,6 @@ using RandomizedTesting.Generators; using System; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis { @@ -111,4 +110,4 @@ public override void Reset() random.Seed = seed; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Analysis/TokenStreamToDot.cs b/src/Lucene.Net.TestFramework/Analysis/TokenStreamToDot.cs index 8ba16d99f3..5910d37685 100644 --- a/src/Lucene.Net.TestFramework/Analysis/TokenStreamToDot.cs +++ b/src/Lucene.Net.TestFramework/Analysis/TokenStreamToDot.cs @@ -1,7 +1,6 @@ using Lucene.Net.Analysis.TokenAttributes; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis { @@ -183,4 +182,4 @@ protected virtual void WriteTrailer() m_out.WriteLine("}"); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs index c76ab663bd..468f6dbe36 100644 --- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs +++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWPostingsFormat.cs @@ -1,7 +1,7 @@ using Lucene.Net.Index; using Lucene.Net.Support; using Lucene.Net.Util; -using Console = Lucene.Net.Util.SystemConsole; +using System; namespace Lucene.Net.Codecs.Lucene3x { diff --git a/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs index ae19b54500..2fdde85b60 100644 --- a/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs +++ b/src/Lucene.Net.TestFramework/Codecs/MockRandom/MockRandomPostingsFormat.cs @@ -12,7 +12,6 @@ using RandomizedTesting.Generators; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Codecs.MockRandom diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs index adb35b2776..6ac654007e 100644 --- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs @@ -12,7 +12,6 @@ using System.IO; using System.Linq; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using JCG = J2N.Collections.Generic; using Test = NUnit.Framework.TestAttribute; diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs index d8f02f14a8..4622496b5d 100644 --- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs @@ -20,7 +20,6 @@ using System.Runtime.ExceptionServices; using System.Text; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using Assert = Lucene.Net.TestFramework.Assert; using RandomInts = RandomizedTesting.Generators.RandomNumbers; using Number = J2N.Numerics.Number; @@ -795,4 +794,4 @@ public virtual void TestBulkMergeWithDeletes() TestUtil.CheckIndex(dir); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs index d3a182818d..31eef9cc1f 100644 --- a/src/Lucene.Net.TestFramework/Index/RandomCodec.cs +++ b/src/Lucene.Net.TestFramework/Index/RandomCodec.cs @@ -21,7 +21,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using J2N.Collections.Generic.Extensions; namespace Lucene.Net.Index @@ -141,32 +140,32 @@ public RandomCodec(Random random, ISet avoidCodecs) new FSTPostingsFormat(), new FSTOrdPostingsFormat(), new FSTPulsing41PostingsFormat(1 + random.Next(20)), new FSTOrdPulsing41PostingsFormat(1 + random.Next(20)), - new DirectPostingsFormat(LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : maxItemsPerBlock), + new DirectPostingsFormat(LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : maxItemsPerBlock), LuceneTestCase.Rarely(random) ? 1 : (LuceneTestCase.Rarely(random) ? int.MaxValue : lowFreqCutoff)), new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock), // add pulsing again with (usually) different parameters new Pulsing41PostingsFormat(1 + random.Next(20), minItemsPerBlock, maxItemsPerBlock), - //TODO as a PostingsFormat which wraps others, we should allow TestBloomFilteredLucene41Postings to be constructed - //with a choice of concrete PostingsFormats. Maybe useful to have a generic means of marking and dealing + //TODO as a PostingsFormat which wraps others, we should allow TestBloomFilteredLucene41Postings to be constructed + //with a choice of concrete PostingsFormats. Maybe useful to have a generic means of marking and dealing //with such "wrapper" classes? - new TestBloomFilteredLucene41Postings(), - new MockSepPostingsFormat(), + new TestBloomFilteredLucene41Postings(), + new MockSepPostingsFormat(), new MockFixedInt32BlockPostingsFormat(TestUtil.NextInt32(random, 1, 2000)), - new MockVariableInt32BlockPostingsFormat(TestUtil.NextInt32(random, 1, 127)), + new MockVariableInt32BlockPostingsFormat(TestUtil.NextInt32(random, 1, 127)), new MockRandomPostingsFormat(random), - new NestedPulsingPostingsFormat(), - new Lucene41WithOrds(), + new NestedPulsingPostingsFormat(), + new Lucene41WithOrds(), new SimpleTextPostingsFormat(), new AssertingPostingsFormat(), - new MemoryPostingsFormat(true, random.NextSingle()), + new MemoryPostingsFormat(true, random.NextSingle()), new MemoryPostingsFormat(false, random.NextSingle()) ); - AddDocValues(avoidCodecs, - new Lucene45DocValuesFormat(), - new DiskDocValuesFormat(), - new MemoryDocValuesFormat(), - new SimpleTextDocValuesFormat(), + AddDocValues(avoidCodecs, + new Lucene45DocValuesFormat(), + new DiskDocValuesFormat(), + new MemoryDocValuesFormat(), + new SimpleTextDocValuesFormat(), new AssertingDocValuesFormat()); formats.Shuffle(random); @@ -218,4 +217,4 @@ public override string ToString() return string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}: {1}, docValues:{2}", base.ToString(), previousMappings, previousDVMappings); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs index adc8dd127e..0bd217bf70 100644 --- a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs +++ b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs @@ -9,7 +9,6 @@ using System.Collections; using System.Collections.Generic; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs index 8ada053450..7b75ff6ecd 100644 --- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs @@ -19,7 +19,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using JCG = J2N.Collections.Generic; diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs index 48057d5085..724d7d5481 100644 --- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs +++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; #if FEATURE_SERIALIZABLE_EXCEPTIONS using System.ComponentModel; using System.Runtime.Serialization; diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs index b245707817..e5acaba0bf 100644 --- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs @@ -14,7 +14,6 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; #if FEATURE_SERIALIZABLE_EXCEPTIONS using System.ComponentModel; diff --git a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs index 609c3606d1..90922befaa 100644 --- a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs @@ -3,7 +3,6 @@ using System; using System.IO; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net.TestFramework/Support/ApiScanTestBase.cs b/src/Lucene.Net.TestFramework/Support/ApiScanTestBase.cs index 99b0d359a6..6f216f2716 100644 --- a/src/Lucene.Net.TestFramework/Support/ApiScanTestBase.cs +++ b/src/Lucene.Net.TestFramework/Support/ApiScanTestBase.cs @@ -8,7 +8,6 @@ using System.Text; using System.Text.RegularExpressions; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs b/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs index b04b6ed639..b290d975ca 100644 --- a/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs +++ b/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs @@ -334,10 +334,6 @@ internal class DefaultLuceneTestFrameworkInitializer : LuceneTestFrameworkInitia /// internal void InitializeStaticState() { - // Enable console output - SystemConsole.Out = Console.Out; - SystemConsole.Error = Console.Error; - // Setup the factories ConfigurationSettings.SetConfigurationFactory(ConfigurationFactory); Codec.SetCodecFactory(CodecFactory); diff --git a/src/Lucene.Net.TestFramework/Util/Fst/FSTTester.cs b/src/Lucene.Net.TestFramework/Util/Fst/FSTTester.cs index cc4917321b..97bcf78658 100644 --- a/src/Lucene.Net.TestFramework/Util/Fst/FSTTester.cs +++ b/src/Lucene.Net.TestFramework/Util/Fst/FSTTester.cs @@ -13,7 +13,6 @@ using System.IO; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using JCG = J2N.Collections.Generic; using Int64 = J2N.Numerics.Int64; diff --git a/src/Lucene.Net.TestFramework/Util/LineFileDocs.cs b/src/Lucene.Net.TestFramework/Util/LineFileDocs.cs index 168d0e7467..6de1a6179a 100644 --- a/src/Lucene.Net.TestFramework/Util/LineFileDocs.cs +++ b/src/Lucene.Net.TestFramework/Util/LineFileDocs.cs @@ -11,7 +11,6 @@ using System.IO.Compression; using System.Text; using System.Threading.Tasks; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs index 07cf5e1fb3..65e7118520 100644 --- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs +++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs @@ -32,7 +32,6 @@ using Assert = Lucene.Net.TestFramework.Assert; using AssumptionViolatedException = NUnit.Framework.InconclusiveException; using Before = NUnit.Framework.SetUpAttribute; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using FieldInfo = Lucene.Net.Index.FieldInfo; using JCG = J2N.Collections.Generic; @@ -3183,9 +3182,9 @@ internal static void LogNativeFSFactoryDebugInfo() { // LUCENENET specific - log the current locking strategy used and HResult values // for assistance troubleshooting problems on Linux/macOS - SystemConsole.WriteLine($"Locking Strategy: {NativeFSLockFactory.LockingStrategy}"); - SystemConsole.WriteLine($"Share Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.ToString() : "null")}"); - SystemConsole.WriteLine($"Lock Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.ToString() : "null")}"); + Console.WriteLine($"Locking Strategy: {NativeFSLockFactory.LockingStrategy}"); + Console.WriteLine($"Share Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.ToString() : "null")}"); + Console.WriteLine($"Lock Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.ToString() : "null")}"); string fileName; try @@ -3195,7 +3194,7 @@ internal static void LogNativeFSFactoryDebugInfo() } catch (Exception e) { - SystemConsole.WriteLine($"Error while creating temp file: {e}"); + Console.WriteLine($"Error while creating temp file: {e}"); return; } @@ -3206,8 +3205,8 @@ internal static void LogNativeFSFactoryDebugInfo() } catch (Exception e) { - SystemConsole.WriteLine($"Error while opening initial share stream: {e}"); - SystemConsole.WriteLine($"******* HResult: {e.HResult}"); + Console.WriteLine($"Error while opening initial share stream: {e}"); + Console.WriteLine($"******* HResult: {e.HResult}"); return; } finally @@ -3221,9 +3220,9 @@ internal static void LogNativeFSFactoryDebugInfo() } catch (IOException io) when (io.HResult != 0) { - SystemConsole.WriteLine($"Successfully retrieved sharing violation."); - SystemConsole.WriteLine($"******* HResult: {io.HResult}"); - SystemConsole.WriteLine($"Exception: {io}"); + Console.WriteLine($"Successfully retrieved sharing violation."); + Console.WriteLine($"******* HResult: {io.HResult}"); + Console.WriteLine($"Exception: {io}"); } finally { diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs index f4bdffb930..1b385f9fdb 100644 --- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs +++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs @@ -21,7 +21,6 @@ using System.Reflection; using System.Threading; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; using AssumptionViolatedException = NUnit.Framework.InconclusiveException; @@ -129,7 +128,7 @@ public override void Before() } savedInfoStream = InfoStream.Default; - Random random = LuceneTestCase.Random; + Random random = LuceneTestCase.Random; bool v = random.NextBoolean(); if (LuceneTestCase.UseInfoStream) { @@ -203,7 +202,7 @@ public override void Before() LuceneTestCase.OldFormatImpersonationIsActive = true; if (Debugging.AssertsEnabled) Debugging.Assert((codec is Lucene45RWCodec), "fix your ICodecFactory to scan Lucene.Net.Tests before Lucene.Net.TestFramework"); } - else if (("random".Equals(LuceneTestCase.TestPostingsFormat, StringComparison.Ordinal) == false) + else if (("random".Equals(LuceneTestCase.TestPostingsFormat, StringComparison.Ordinal) == false) || ("random".Equals(LuceneTestCase.TestDocValuesFormat, StringComparison.Ordinal) == false)) { // the user wired postings or DV: this is messy @@ -235,23 +234,23 @@ public override void Before() codec = new Lucene46CodecAnonymousClass(format, dvFormat); } - else if ("SimpleText".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) + else if ("SimpleText".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) || ("random".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) && randomVal == 9 && LuceneTestCase.Rarely(random) && !ShouldAvoidCodec("SimpleText"))) { codec = new SimpleTextCodec(); } - else if ("CheapBastard".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) + else if ("CheapBastard".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) || ("random".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) && randomVal == 8 && !ShouldAvoidCodec("CheapBastard") && !ShouldAvoidCodec("Lucene41"))) { // we also avoid this codec if Lucene41 is avoided, since thats the postings format it uses. codec = new CheapBastardCodec(); } - else if ("Asserting".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) + else if ("Asserting".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) || ("random".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) && randomVal == 6 && !ShouldAvoidCodec("Asserting"))) { codec = new AssertingCodec(); } - else if ("Compressing".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) + else if ("Compressing".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) || ("random".Equals(LuceneTestCase.TestCodec, StringComparison.Ordinal) && randomVal == 5 && !ShouldAvoidCodec("Compressing"))) { codec = CompressingCodec.RandomInstance(random); @@ -271,7 +270,7 @@ public override void Before() Codec.Default = codec; // Initialize locale/ timezone. - + string testTimeZone = SystemProperties.GetProperty("tests:timezone", "random"); // LUCENENET specific - reformatted with : // LUCENENET: We need to ensure our random generator stays consistent here so we can repeat the session exactly, @@ -292,7 +291,7 @@ public override void Before() // Always pick a random one for consistency (whether tests.locale was specified or not). savedLocale = CultureInfo.CurrentCulture; - + locale = testLocale.Equals("random", StringComparison.Ordinal) ? randomLocale : LuceneTestCase.CultureForName(testLocale); #if FEATURE_CULTUREINFO_CURRENTCULTURE_SETTER CultureInfo.CurrentCulture = locale; @@ -409,4 +408,4 @@ private bool ShouldAvoidCodec(string codec) return avoidCodecs.Count > 0 && avoidCodecs.Contains(codec); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs index ad25bf4186..4b9708a54d 100644 --- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs +++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs @@ -18,7 +18,6 @@ using System.Text; using System.Text.RegularExpressions; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; using JCG = J2N.Collections.Generic; using RandomInts = RandomizedTesting.Generators.RandomNumbers; diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/TestMappingCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/TestMappingCharFilter.cs index fd0a5aeae4..8111052a00 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/TestMappingCharFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/CharFilters/TestMappingCharFilter.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Analysis.CharFilters @@ -217,7 +216,7 @@ public virtual void TestRandom() Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false); return new TokenStreamComponents(tokenizer, tokenizer); }, initReader: (fieldName, reader) => - { + { return new MappingCharFilter(normMap, reader); }); @@ -500,4 +499,4 @@ public virtual void TestRandomMaps2() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs index 99404217e8..1be98f11d7 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs @@ -9,7 +9,6 @@ using NUnit.Framework; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Analysis.Core @@ -57,7 +56,7 @@ public virtual void Test() { reader = new MockCharFilter(reader, 0); reader = new MappingCharFilter(map, reader); - return reader; + return reader; }); CheckAnalysisConsistency(Random, a, false, "wmgddzunizdomqyj"); } @@ -311,4 +310,4 @@ public virtual void TestCuriousWikipediaString() CheckAnalysisConsistency(Random, a, false, "B\u28c3\ue0f8[ \ud800\udfc2

jb"); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs index 41720d2065..ab33970066 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestRandomChains.cs @@ -35,7 +35,6 @@ using System.Reflection; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Analysis.Core diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs index c010241176..3d934cc90a 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestStopFilter.cs @@ -7,7 +7,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; using Version = Lucene.Net.Util.LuceneVersion; diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs index 722b0bf922..9759f572db 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestTypeTokenFilter.cs @@ -3,11 +3,11 @@ using Lucene.Net.Analysis.TokenAttributes; using Lucene.Net.Util; using NUnit.Framework; +using System; using System.Collections.Generic; using System.IO; using System.Text; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Core { @@ -76,7 +76,7 @@ public virtual void TestStopPositons() reader = new StringReader(sb.ToString()); typeTokenFilter = #pragma warning disable 612, 618 - new TypeTokenFilter(LuceneVersion.LUCENE_43, + new TypeTokenFilter(LuceneVersion.LUCENE_43, #pragma warning restore 612, 618 false, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet); TestPositons(typeTokenFilter); @@ -117,4 +117,4 @@ private static void log(string s) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs index 7c3b0f9c6f..df7d4a8fdd 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries.cs @@ -6,7 +6,6 @@ using System.IO; using System.IO.Compression; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Hunspell { @@ -31,12 +30,12 @@ namespace Lucene.Net.Analysis.Hunspell /// Can be retrieved via: /// wget --mirror -np http://archive.services.openoffice.org/pub/mirror/OpenOffice.org/contrib/dictionaries/ /// Note some of the files differ only in case. This may be a problem on your operating system! - /// + /// /// LUCENENET NOTE: The above URL is no longer valid. These dictionaries can be retreived via FTP at one of these URLs /// ftp://ftp.us.horde.org/pub/software/openoffice/contrib/dictionaries/ /// ftp://mirror.nl.leaseweb.net/openoffice/contrib/dictionaries/ /// ftp://mirror.aptus.co.tz/openoffice/contrib/dictionaries/ - /// + /// /// Or you can search by file name at: /// http://www.filewatcher.com/ ///
@@ -50,7 +49,7 @@ public class TestAllDictionaries : LuceneTestCase System.IO.Path.Combine(new DirectoryInfo(typeof(TestAllDictionaries2).Assembly.Location).Parent.Parent.Parent.Parent.Parent.Parent.FullName, @"test-files\analysis\data\dictionaries")); - internal readonly string[] tests = new string[] + internal readonly string[] tests = new string[] { /* zip file */ /* dictionary */ /* affix */ "af_ZA.zip", "af_ZA.dic", "af_ZA.aff", @@ -217,4 +216,4 @@ public virtual void TestOneDictionary() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs index 9501ade107..08f86cc6c5 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Hunspell/TestAllDictionaries2.cs @@ -6,7 +6,6 @@ using System.IO; using System.IO.Compression; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Hunspell { @@ -31,9 +30,9 @@ namespace Lucene.Net.Analysis.Hunspell /// These thunderbird dictionaries can be retrieved via: /// https://addons.mozilla.org/en-US/thunderbird/language-tools/ /// You must click and download every file: sorry! - /// + /// /// To retrieve these exact versions, you can search for the - /// file name at: + /// file name at: /// http://www.filewatcher.com/ ///
@@ -232,4 +231,4 @@ public virtual void TestOneDictionary() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs index d940ed37ca..bf272ae706 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Pattern/TestPatternReplaceCharFilter.cs @@ -7,7 +7,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Pattern { @@ -224,7 +223,7 @@ private Regex pattern(string p) } /// - /// A demonstration of how backtracking regular expressions can lead to relatively + /// A demonstration of how backtracking regular expressions can lead to relatively /// easy DoS attacks. /// /// @@ -274,4 +273,4 @@ public virtual void TestRandomStrings() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs index e9a1dcf742..cbbc7c7d23 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Sinks/TestTeeSinkTokenFilter.cs @@ -12,7 +12,6 @@ using System.Globalization; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Sinks { @@ -84,7 +83,7 @@ public override bool Accept(AttributeSource a) } // LUCENE-1448 - // TODO: instead of testing it this way, we can test + // TODO: instead of testing it this way, we can test // with BaseTokenStreamTestCase now... [Test] public virtual void TestEndOffsetPositionWithTeeSinkTokenFilter() @@ -301,4 +300,4 @@ public override bool Accept(AttributeSource a) } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs index 4006706ee1..45d3ca8633 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Snowball/TestSnowballVocab.cs @@ -2,7 +2,7 @@ using Lucene.Net.Analysis.Core; using Lucene.Net.Util; using NUnit.Framework; -using Console = Lucene.Net.Util.SystemConsole; +using System; namespace Lucene.Net.Analysis.Snowball { @@ -38,7 +38,7 @@ public virtual void TestStemmers() AssertCorrectOutput("Danish", "danish"); AssertCorrectOutput("Dutch", "dutch"); AssertCorrectOutput("English", "english"); - // disabled due to snowball java code generation bug: + // disabled due to snowball java code generation bug: // see http://article.gmane.org/gmane.comp.search.snowball/1139 // assertCorrectOutput("Finnish", "finnish"); AssertCorrectOutput("French", "french"); @@ -47,7 +47,7 @@ public virtual void TestStemmers() AssertCorrectOutput("Hungarian", "hungarian"); AssertCorrectOutput("Italian", "italian"); AssertCorrectOutput("Kp", "kraaij_pohlmann"); - // disabled due to snowball java code generation bug: + // disabled due to snowball java code generation bug: // see http://article.gmane.org/gmane.comp.search.snowball/1139 // assertCorrectOutput("Lovins", "lovins"); AssertCorrectOutput("Norwegian", "norwegian"); @@ -80,4 +80,4 @@ private void AssertCorrectOutput(string snowballLanguage, string dataDirectory) VocabularyAssert.AssertVocabulary(a, GetDataFile("TestSnowballVocabData.zip"), dataDirectory + "/voc.txt", dataDirectory + "/output.txt"); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs index 76b6b9b3d0..f4cc112241 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs @@ -13,7 +13,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Analysis.Synonym diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs index f5a751316c..648dac9440 100644 --- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs +++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestRollingCharBuffer.cs @@ -2,8 +2,8 @@ using Lucene.Net.Util; using NUnit.Framework; using RandomizedTesting.Generators; +using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Util { @@ -45,9 +45,9 @@ public virtual void Test() var random = LuceneTestCase.Random; for (var iter = 0; iter < ITERS; iter++) - { + { var stringLen = random.NextBoolean() ? random.Next(50) : random.Next(20000); - + string s; if (stringLen == 0) { @@ -134,4 +134,4 @@ public virtual void Test() } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs b/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs index 5a6fbfbfef..65ab03f53f 100644 --- a/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs +++ b/src/Lucene.Net.Tests.Analysis.ICU/Analysis/Icu/Segmentation/TestICUTokenizer.cs @@ -157,7 +157,7 @@ public void TestLao() } [Test] - public void TestMyanmar() + public void TestMyanmar() { AssertAnalyzesTo(a, "သက်ဝင်လှုပ်ရှားစေပြီး", new String[] { "သက်ဝင်", "လှုပ်ရှား", "စေ", "ပြီး" }); } @@ -383,7 +383,7 @@ public override void Run() if (Verbose) { - SystemConsole.Out.WriteLine(tokenCount); + Console.Out.WriteLine(tokenCount); } } } @@ -414,4 +414,4 @@ public void TestICUConcurrency() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs index d576292c9d..2a2a7c6f8b 100644 --- a/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs +++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/Dict/TestTokenInfoDictionary.cs @@ -3,7 +3,6 @@ using Lucene.Net.Util.Fst; using NUnit.Framework; using System; -using Console = Lucene.Net.Util.SystemConsole; using Int64 = J2N.Numerics.Int64; namespace Lucene.Net.Analysis.Ja.Dict diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs index f649a03d13..be794d4abb 100644 --- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs +++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestJapaneseTokenizer.cs @@ -13,7 +13,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Ja { diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs index bc9c61fb06..a7647710b0 100644 --- a/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs +++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/TestSearchMode.cs @@ -4,7 +4,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Ja { diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs index 101405be11..ec899c7a06 100644 --- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs +++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/CacheSubSequencePerformanceTest.cs @@ -1,9 +1,9 @@ using J2N.Text; using Lucene.Net.Util; using NUnit.Framework; +using System; using System.Diagnostics; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Phonetic.Language.Bm { diff --git a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs index 728d1052d0..45c36df7d0 100644 --- a/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs +++ b/src/Lucene.Net.Tests.Analysis.Phonetic/Language/Bm/PhoneticEnginePerformanceTest.cs @@ -1,7 +1,7 @@ using Lucene.Net.Util; using NUnit.Framework; +using System; using System.Diagnostics; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis.Phonetic.Language.Bm { diff --git a/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs b/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs index de12cf0c5a..e38d739f43 100644 --- a/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs +++ b/src/Lucene.Net.Tests.Benchmark/BenchmarkTestCase.cs @@ -3,7 +3,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks { diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs index 169b781504..eb96b5240c 100644 --- a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs +++ b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/CreateIndexTaskTest.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Benchmarks.ByTask.Tasks { @@ -56,7 +55,7 @@ public void TestInfoStream_SystemOutErr() TextWriter curOut = Console.Out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Console.Out = new StreamWriter(baos, Encoding.Default); + Console.SetOut(new StreamWriter(baos, Encoding.Default)); try { PerfRunData runData = createPerfRunData("SystemOut"); @@ -67,12 +66,12 @@ public void TestInfoStream_SystemOutErr() } finally { - Console.Out = curOut; + Console.SetOut(curOut); } TextWriter curErr = Console.Error; baos = new ByteArrayOutputStream(); - Console.Error = new StreamWriter(baos, Encoding.Default); + Console.SetError(new StreamWriter(baos, Encoding.Default)); try { PerfRunData runData = createPerfRunData("SystemErr"); @@ -83,7 +82,7 @@ public void TestInfoStream_SystemOutErr() } finally { - Console.Error = curErr; + Console.SetError(curErr); } } diff --git a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs index 871a626581..b1b088325f 100644 --- a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs +++ b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet { @@ -170,7 +169,7 @@ protected internal virtual void SortTies(LabelAndValue[] labelValues) i++; } } - + protected internal virtual void SortLabelValues(JCG.List labelValues) { labelValues.Sort(Comparer.Create((a,b) => { @@ -189,7 +188,7 @@ protected internal virtual void SortLabelValues(JCG.List labelVal })); } - + protected internal virtual void SortFacetResults(JCG.List results) { results.Sort(Comparer.Create((a, b) => @@ -248,4 +247,4 @@ protected virtual void AssertFloatValuesEquals(FacetResult a, FacetResult b) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs index fba5e06250..00339206a1 100644 --- a/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs +++ b/src/Lucene.Net.Tests.Facet/Range/TestRangeFacetCounts.cs @@ -8,7 +8,6 @@ using System.Collections; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet.Range { diff --git a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs index fac9d4dc77..a63fca08ed 100644 --- a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs +++ b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet.SortedSet { @@ -388,4 +387,4 @@ public virtual void TestRandom() IOUtils.Dispose(w, searcher.IndexReader, indexDir, taxoDir); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs index ce33e095e0..670302194d 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestConcurrentFacetedIndexing.cs @@ -5,7 +5,6 @@ using System.IO; using NUnit.Framework; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using J2N.Threading; namespace Lucene.Net.Facet.Taxonomy.Directory diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs index dbc100138f..d2a36f031e 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/Directory/TestDirectoryTaxonomyWriter.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet.Taxonomy.Directory { diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs index 2a827b7894..46d3b98b60 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestSearcherTaxonomyManager.cs @@ -11,7 +11,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Facet.Taxonomy @@ -256,7 +255,7 @@ public override void Run() } } - + [Test] [Slow] [Timeout(2_400_000)] // 40 minutes @@ -401,4 +400,4 @@ public virtual void TestReplaceTaxonomyDirectory() IOUtils.Dispose(mgr, tw, w, taxoDir, indexDir); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs index 02f8764f7b..fa3a12ec7d 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs @@ -9,7 +9,6 @@ using System.IO; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Facet.Taxonomy diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs index 01628b91fb..6ed24e9e2f 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs @@ -10,7 +10,6 @@ using System.Runtime.CompilerServices; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet.Taxonomy { diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs index d38b1fd459..43eeb9b239 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/WriterCache/TestCompactLabelToOrdinal.cs @@ -7,7 +7,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Facet.Taxonomy.WriterCache { diff --git a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs index 79d3332f59..65d3e39f33 100644 --- a/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs +++ b/src/Lucene.Net.Tests.Facet/TestDrillSideways.cs @@ -11,7 +11,6 @@ using System.Globalization; using System.Linq; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Facet diff --git a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs index 6b495609cf..e21f1b3995 100644 --- a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs +++ b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs @@ -14,7 +14,6 @@ using System.Collections.Generic; using System.Globalization; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Grouping diff --git a/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs index 6fb45fbf22..b4328aadee 100644 --- a/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs +++ b/src/Lucene.Net.Tests.Grouping/AllGroupsCollectorTest.cs @@ -12,7 +12,6 @@ using NUnit.Framework; using System; using System.Collections; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Grouping { diff --git a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs index feb90269df..5fa1dbfa06 100644 --- a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs +++ b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs @@ -14,7 +14,6 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Grouping diff --git a/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs index a4c5ae0690..57316e30bd 100644 --- a/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs +++ b/src/Lucene.Net.Tests.Grouping/GroupFacetCollectorTest.cs @@ -13,7 +13,6 @@ using System.Collections.Generic; using System.Globalization; using Collections = Lucene.Net.Support.Collections; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; @@ -602,7 +601,7 @@ private IndexContext CreateIndexContext(bool multipleFacetValuesPerDocument) return a.CompareToOrdinal(b); } })); - + // LUCENENET NOTE: Need JCG.Dictionary here because of null keys IDictionary>> searchTermToFacetToGroups = new Dictionary>>(); int facetWithMostGroups = 0; diff --git a/src/Lucene.Net.Tests.Grouping/TestGrouping.cs b/src/Lucene.Net.Tests.Grouping/TestGrouping.cs index 3cfb50a896..9c05cb35d6 100644 --- a/src/Lucene.Net.Tests.Grouping/TestGrouping.cs +++ b/src/Lucene.Net.Tests.Grouping/TestGrouping.cs @@ -39,7 +39,6 @@ using System.Globalization; using System.Linq; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Grouping @@ -252,7 +251,7 @@ private IAbstractSecondPassGroupingCollector CreateSecondPassCollector(IAb { if (firstPassGroupingCollector.GetType().IsAssignableFrom(typeof(TermFirstPassGroupingCollector))) { - return new TermSecondPassGroupingCollector(groupField, searchGroups, groupSort, sortWithinGroup, maxDocsPerGroup, getScores, getMaxScores, fillSortFields) + return new TermSecondPassGroupingCollector(groupField, searchGroups, groupSort, sortWithinGroup, maxDocsPerGroup, getScores, getMaxScores, fillSortFields) as IAbstractSecondPassGroupingCollector; } else @@ -340,7 +339,7 @@ private IEnumerable> GetSearchGroups(IAbstractFirstPas } else if (typeof(FunctionFirstPassGroupingCollector).IsAssignableFrom(c.GetType())) // LUCENENET Specific type for generic must be specified. { - // LUCENENET NOTE: This is IEnumerable instead of ICollection because it + // LUCENENET NOTE: This is IEnumerable instead of ICollection because it // needs to be covariant to mimic the wildcard generics in Java IEnumerable> mutableValueGroups = ((FunctionFirstPassGroupingCollector)c).GetTopGroups(groupOffset, fillFields); // LUCENENET Specific type for generic must be specified. if (mutableValueGroups is null) @@ -551,7 +550,7 @@ private TopGroups SlowGrouping(GroupDoc[] groupDocs, // when the values differ. //Arrays.Sort(groupDocs, groupSortComp); ArrayUtil.TimSort(groupDocs, groupSortComp); - + IDictionary> groups = new JCG.Dictionary>(); IList sortedGroups = new JCG.List(); IList sortedGroupFields = new JCG.List(); diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs index 0f8d3875d8..478511b270 100644 --- a/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs +++ b/src/Lucene.Net.Tests.Highlighter/Highlight/Custom/HighlightCustomQueryTest.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Highlight.Custom { diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs index 0644f95336..bb86e2d902 100644 --- a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs +++ b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs @@ -19,7 +19,6 @@ using System.Text; using System.Xml; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Highlight { diff --git a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs index 186184d65f..bfab063b73 100644 --- a/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs +++ b/src/Lucene.Net.Tests.Highlighter/VectorHighlight/SimpleFragListBuilderTest.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using System; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.VectorHighlight { diff --git a/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs index 524253e8c7..5f3b10a029 100644 --- a/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs +++ b/src/Lucene.Net.Tests.Join/Support/TestBlockJoin.cs @@ -17,7 +17,6 @@ using System.Globalization; using System.Linq; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Tests.Join { diff --git a/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs index 7b0ee0d718..68cefb53b5 100644 --- a/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs +++ b/src/Lucene.Net.Tests.Join/Support/TestJoinUtil.cs @@ -13,7 +13,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Tests.Join diff --git a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs index b8f5704ac0..6cd854c06e 100644 --- a/src/Lucene.Net.Tests.Join/TestBlockJoin.cs +++ b/src/Lucene.Net.Tests.Join/TestBlockJoin.cs @@ -16,7 +16,6 @@ using System.Linq; using System.Text; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Join { diff --git a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs index 69d2d27380..320de70392 100644 --- a/src/Lucene.Net.Tests.Join/TestJoinUtil.cs +++ b/src/Lucene.Net.Tests.Join/TestJoinUtil.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Join diff --git a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs index f80fd19589..48510f068a 100644 --- a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs +++ b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs @@ -36,7 +36,6 @@ using System.IO; using System.Text; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index.Memory { diff --git a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs index 43d0b33088..8fb3eac857 100644 --- a/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs +++ b/src/Lucene.Net.Tests.Misc/Document/TestLazyDocument.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Documents { diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs index 2bd75ecf10..f8595e26ca 100644 --- a/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs +++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/IndexSortingTest.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index.Sorter { diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs index f3aeb27246..9c70157327 100644 --- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs +++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs @@ -12,7 +12,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index.Sorter diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs index 678c5ad189..ddf995dfa0 100644 --- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs +++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SortingAtomicReaderTest.cs @@ -3,7 +3,6 @@ using Lucene.Net.Util; using NUnit.Framework; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index.Sorter { diff --git a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs index 185120611a..ee0171b64f 100644 --- a/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs +++ b/src/Lucene.Net.Tests.Misc/Util/Fst/TestFSTsMisc.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; using Int64 = J2N.Numerics.Int64; @@ -128,7 +127,7 @@ private void DoTest(int inputMode, Int32sRef[] terms) { Console.WriteLine("TEST: now test OneOrMoreOutputs"); } - PositiveInt32Outputs _outputs = PositiveInt32Outputs.Singleton; + PositiveInt32Outputs _outputs = PositiveInt32Outputs.Singleton; ListOfOutputs outputs2 = new ListOfOutputs(_outputs); IList> pairs2 = new JCG.List>(terms.Length); long lastOutput2 = 0; diff --git a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs index c445a72de5..aac0728ed5 100644 --- a/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs +++ b/src/Lucene.Net.Tests.Queries/Function/FunctionTestSetup.cs @@ -9,7 +9,6 @@ using Lucene.Net.Store; using Lucene.Net.Util; using NUnit.Framework; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Tests.Queries.Function { diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs index 10fcf32b30..5fad5872b2 100644 --- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs +++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs @@ -7,7 +7,6 @@ using Lucene.Net.Util; using NUnit.Framework; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Flexible.Spans { @@ -55,10 +54,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans /// compound by 2 processors: and /// . /// - /// : as it's going to use the current + /// : as it's going to use the current /// query parser to parse the syntax, it will support more features than we want, /// this processor basically validates the query node tree generated by the parser - /// and just let got through the elements we want, all the other elements as + /// and just let got through the elements we want, all the other elements as /// wildcards, range queries, etc...if found, an exception is thrown. /// /// : this processor will take care of reading @@ -71,7 +70,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans /// objects from objects. ///
/// for a more advanced example - /// + /// /// /// /// diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs index 797e02d549..4edc63f05f 100644 --- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs @@ -14,7 +14,6 @@ using System.Collections.Generic; using System.Globalization; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; #nullable enable diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs index 2a20ef5611..a63fdd8b7f 100644 --- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs +++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs @@ -19,7 +19,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Flexible.Standard { diff --git a/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs b/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs index 15d8affbd0..1e82d90220 100644 --- a/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs +++ b/src/Lucene.Net.Tests.QueryParser/Support/Flexible/Standard/Config/TestNumberDateFormat.cs @@ -10,7 +10,6 @@ using Lucene.Net.Util; using TimeZoneConverter; using NUnit.Framework; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Flexible.Standard.Config diff --git a/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs b/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs index a8bd471536..46ac44c6fb 100644 --- a/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs +++ b/src/Lucene.Net.Tests.QueryParser/Surround/Query/BooleanQueryTst.cs @@ -1,8 +1,8 @@ using Lucene.Net.Index; using Lucene.Net.Search; +using System; using System.Diagnostics.CodeAnalysis; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Surround.Query { diff --git a/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs b/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs index 91ba9522b9..f53bd2de35 100644 --- a/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs +++ b/src/Lucene.Net.Tests.QueryParser/Surround/Query/ExceptionQueryTst.cs @@ -1,7 +1,6 @@ using Lucene.Net.QueryParsers.Surround.Parser; using System; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Surround.Query { diff --git a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs index 142367c183..29e43097ed 100644 --- a/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs +++ b/src/Lucene.Net.Tests.QueryParser/Util/QueryParserTestBase.cs @@ -34,7 +34,6 @@ using NUnit.Framework; using System; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Util { diff --git a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs index 5bb9c16dc6..6f0c77055a 100644 --- a/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Xml/TestParser.cs @@ -9,7 +9,6 @@ using System.IO; using System.Reflection; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.QueryParsers.Xml { diff --git a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs index a57115f84c..861b3b5a06 100644 --- a/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs +++ b/src/Lucene.Net.Tests.Replicator/IndexAndTaxonomyReplicationClientTest.cs @@ -17,7 +17,6 @@ using System.IO; using System.Runtime.ExceptionServices; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; namespace Lucene.Net.Replicator diff --git a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs index 8ff27fb5b3..d7af81c7fa 100644 --- a/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs +++ b/src/Lucene.Net.Tests.Replicator/IndexReplicationClientTest.cs @@ -13,7 +13,6 @@ using System.IO; using System.Runtime.ExceptionServices; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using Directory = Lucene.Net.Store.Directory; namespace Lucene.Net.Replicator diff --git a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs index 949a57cef0..494fc22f8d 100644 --- a/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs +++ b/src/Lucene.Net.Tests.Sandbox/Queries/TestSlowFuzzyQuery2.cs @@ -14,7 +14,6 @@ using System.Linq; using System.Reflection; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Sandbox.Queries { @@ -35,26 +34,26 @@ namespace Lucene.Net.Sandbox.Queries * limitations under the License. */ - /** - * Tests the results of fuzzy against pre-recorded output + /** + * Tests the results of fuzzy against pre-recorded output * The format of the file is the following: - * - * Header Row: # of bits: generate 2^n sequential documents + * + * Header Row: # of bits: generate 2^n sequential documents * with a value of Integer.toBinaryString - * + * * Entries: an entry is a param spec line, a resultCount line, and * then 'resultCount' results lines. The results lines are in the * expected order. - * + * * param spec line: a comma-separated list of params to FuzzyQuery * (query, prefixLen, pqSize, minScore) * query = query text as a number (expand with Integer.toBinaryString) * prefixLen = prefix length * pqSize = priority queue maximum size for TopTermsBoostOnlyBooleanQueryRewrite * minScore = minimum similarity - * + * * resultCount line: total number of expected hits. - * + * * results line: comma-separated docID, score pair **/ public class TestSlowFuzzyQuery2 : LuceneTestCase diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs index 884d4c2c71..7a25716fd4 100644 --- a/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs +++ b/src/Lucene.Net.Tests.Spatial/Prefix/NtsPolygonTest.cs @@ -9,7 +9,6 @@ using Spatial4n.Shapes; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Spatial.Prefix { diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs index bd152d1f07..b1e3fe2109 100644 --- a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs +++ b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Linq; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Spatial.Prefix { diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs index 870d3a226e..9cfa9d6a64 100644 --- a/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs +++ b/src/Lucene.Net.Tests.Spatial/Prefix/Tree/SpatialPrefixTreeTest.cs @@ -5,7 +5,6 @@ using Spatial4n.Context; using Spatial4n.Shapes; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Spatial.Prefix.Tree { diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs index f1ca96460e..6005157b39 100644 --- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs +++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs @@ -15,7 +15,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Spell { diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs index 88d333ab5c..00bb9a52fe 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs @@ -16,7 +16,6 @@ using System.Text.RegularExpressions; using System.Threading; using static Lucene.Net.Search.Suggest.Lookup; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest.Analyzing @@ -117,7 +116,7 @@ public void TestAfterLoad() } /// - /// Used to return highlighted result; see + /// Used to return highlighted result; see /// /// private sealed class LookupHighlightFragment @@ -445,7 +444,7 @@ public void TestSuggestStopFilter() public void TestEmptyAtStart() { Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(new Input[0])); suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz")); suggester.Add(new BytesRef("lend me your ear"), null, 8, new BytesRef("foobar")); diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs index 1d36a2196b..80847eae76 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingSuggesterTest.cs @@ -12,7 +12,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest.Analyzing @@ -258,7 +257,7 @@ public void TestNoSeps() suggester.Build(new InputArrayEnumerator(keys)); // TODO: would be nice if "ab " would allow the test to // pass, and more generally if the analyzer can know - // that the user's current query has ended at a word, + // that the user's current query has ended at a word, // but, analyzers don't produce SEP tokens! IList r = suggester.DoLookup(TestUtil.StringToCharSequence("ab c", Random).ToString(), false, 2); assertEquals(2, r.size()); @@ -426,8 +425,8 @@ public void TestInputPathRequired() // final SynonymMap map = b.build(); // The Analyzer below mimics the functionality of the SynonymAnalyzer - // using the above map, so that the suggest module does not need a dependency on the - // synonym module + // using the above map, so that the suggest module does not need a dependency on the + // synonym module Analyzer analyzer = new TestInputPathRequiredAnalyzer(this); @@ -465,11 +464,11 @@ private void printTokens(final Analyzer analyzer, String input) throws IOExcepti while(ts.incrementToken()) { termBytesAtt.fillBytesRef(); - System.out.println(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength())); + System.out.println(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength())); } ts.end(); ts.close(); - } + } */ internal class UsualTokenStreamComponents : TokenStreamComponents diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs index e5e6541beb..b13c7166fb 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Suggest.Analyzing { @@ -167,7 +166,7 @@ public void TestRequiresMore() suggester.Dispose(); } - + /** * Handle trailing spaces that result in no prefix token LUCENE-6093 */ diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs index d97602f1c4..840775a90f 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/FuzzySuggesterTest.cs @@ -13,7 +13,6 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest.Analyzing @@ -210,7 +209,7 @@ public void TestNoSeps() suggester.Build(new InputArrayEnumerator(keys)); // TODO: would be nice if "ab " would allow the test to // pass, and more generally if the analyzer can know - // that the user's current query has ended at a word, + // that the user's current query has ended at a word, // but, analyzers don't produce SEP tokens! IList r = suggester.DoLookup(TestUtil.StringToCharSequence("ab c", Random).ToString(), false, 2); assertEquals(2, r.size()); @@ -386,8 +385,8 @@ public void TestInputPathRequired() // final SynonymMap map = b.build(); // The Analyzer below mimics the functionality of the SynonymAnalyzer - // using the above map, so that the suggest module does not need a dependency on the - // synonym module + // using the above map, so that the suggest module does not need a dependency on the + // synonym module Analyzer analyzer = new TestInputPathRequiredAnalyzer(this); @@ -420,11 +419,11 @@ private void printTokens(final Analyzer analyzer, String input) throws IOExcepti while(ts.incrementToken()) { termBytesAtt.fillBytesRef(); - Console.WriteLine(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength())); + Console.WriteLine(String.format("%s,%s,%s", termBytesAtt.getBytesRef().utf8ToString(), posIncAtt.getPositionIncrement(), posLengthAtt.getPositionLength())); } ts.end(); ts.close(); - } + } */ internal class UsualTokenStreamComponents : TokenStreamComponents @@ -1334,10 +1333,10 @@ public int GetDistance(string target, string other, bool allowTransposition) int n; int[][] d; // cost array - // NOTE: if we cared, we could 3*m space instead of m*n space, similar to - // what LevenshteinDistance does, except cycling thru a ring of three - // horizontal cost arrays... but this comparer is never actually used by - // DirectSpellChecker, its only used for merging results from multiple shards + // NOTE: if we cared, we could 3*m space instead of m*n space, similar to + // what LevenshteinDistance does, except cycling thru a ring of three + // horizontal cost arrays... but this comparer is never actually used by + // DirectSpellChecker, its only used for merging results from multiple shards // in "distributed spellcheck", and its inefficient in other ways too... // cheaper to do this up front once diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs index 3919605563..782143267b 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs @@ -12,7 +12,6 @@ using System.Globalization; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest.Analyzing @@ -602,7 +601,7 @@ public void TestRandom() //Integer count = model.get(ngram); if (model.TryGetValue(ngram, out int count)) { - // LUCENENET NOTE: We need to calculate this as decimal because when using double it can sometimes + // LUCENENET NOTE: We need to calculate this as decimal because when using double it can sometimes // return numbers that are greater than long.MaxValue, which results in a negative long number. // This is also the way it is being done in the FreeTextSuggester to work around the issue. diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs index 9e6c80f3fb..f9c417d1ce 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/FSTCompletionTest.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.Text; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest.Fst @@ -96,7 +95,7 @@ public void TestExactMatchLowPriority() [Test] public void TestExactMatchReordering() { - // Check reordering of exact matches. + // Check reordering of exact matches. AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 4), "four/0.0", "fourblah/1.0", @@ -112,12 +111,12 @@ public void TestRequestedCount() "one/0.0", "oneness/1.0"); - // 'four' is collected in a bucket and then again as an exact match. + // 'four' is collected in a bucket and then again as an exact match. AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 2), "four/0.0", "fourblah/1.0"); - // Check reordering of exact matches. + // Check reordering of exact matches. AssertMatchEquals(completion.DoLookup(StringToCharSequence("four").ToString(), 4), "four/0.0", "fourblah/1.0", @@ -135,7 +134,7 @@ public void TestRequestedCount() "oneness/1.0", "onerous/1.0"); - // 'one' is at the top after collecting all alphabetical results. + // 'one' is at the top after collecting all alphabetical results. AssertMatchEquals(completionAlphabetical.DoLookup(StringToCharSequence("one").ToString(), 2), "one/0.0", "oneness/1.0"); diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs index 19a6a45870..2ce82c67e5 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/LargeInputFST.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Suggest.Fst { diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs index 07eba88c7d..8a2deb82ab 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs @@ -17,7 +17,6 @@ using System.Linq; using System.Reflection; using System.Text; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search.Suggest diff --git a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs index 5f43e11d67..5858f89484 100644 --- a/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs +++ b/src/Lucene.Net.Tests/Analysis/TestGraphTokenizers.cs @@ -9,7 +9,6 @@ using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Analysis { diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs index 215046485d..c7d2694fb0 100644 --- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs +++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Codecs.Lucene3x { diff --git a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs index 3c8db26608..5bad7e0fad 100644 --- a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs +++ b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat2.cs @@ -13,7 +13,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; namespace Lucene.Net.Codecs.PerField diff --git a/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs index f253121445..a3b584a0df 100644 --- a/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs +++ b/src/Lucene.Net.Tests/Index/Test2BBinaryDocValues.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs index 8f630f7b26..6c60627971 100644 --- a/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs +++ b/src/Lucene.Net.Tests/Index/Test2BNumericDocValues.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/Test2BPositions.cs b/src/Lucene.Net.Tests/Index/Test2BPositions.cs index e714d9fdad..daf8c66150 100644 --- a/src/Lucene.Net.Tests/Index/Test2BPositions.cs +++ b/src/Lucene.Net.Tests/Index/Test2BPositions.cs @@ -4,7 +4,6 @@ using Lucene.Net.Store; using NUnit.Framework; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/Test2BPostings.cs b/src/Lucene.Net.Tests/Index/Test2BPostings.cs index 44ddbf4cdb..53c9983dc2 100644 --- a/src/Lucene.Net.Tests/Index/Test2BPostings.cs +++ b/src/Lucene.Net.Tests/Index/Test2BPostings.cs @@ -4,7 +4,6 @@ using Lucene.Net.Store; using NUnit.Framework; using System; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs b/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs index 113206f0a4..5114bd2648 100644 --- a/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs +++ b/src/Lucene.Net.Tests/Index/Test2BSortedDocValues.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/Index/Test2BTerms.cs index aa32f51cc0..49226d0ab6 100644 --- a/src/Lucene.Net.Tests/Index/Test2BTerms.cs +++ b/src/Lucene.Net.Tests/Index/Test2BTerms.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs index 4539ef62a0..5639da8dec 100644 --- a/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs +++ b/src/Lucene.Net.Tests/Index/Test4GBStoredFields.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomInts = RandomizedTesting.Generators.RandomNumbers; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs index b07ceeb147..f5d9395910 100644 --- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs +++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs @@ -10,7 +10,6 @@ using System.Linq; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs index bdd356a02e..284a758ca9 100644 --- a/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs +++ b/src/Lucene.Net.Tests/Index/TestAtomicUpdate.cs @@ -7,7 +7,6 @@ using System; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs index 91bf151c48..65fecf6be6 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs @@ -10,7 +10,6 @@ using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs index 77239b5546..f46e28a544 100644 --- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs +++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs @@ -9,7 +9,6 @@ using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs index b81ba92038..e0bf419794 100644 --- a/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs +++ b/src/Lucene.Net.Tests/Index/TestBagOfPositions.cs @@ -12,7 +12,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs index 87b8324853..9cfb3b6551 100644 --- a/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs +++ b/src/Lucene.Net.Tests/Index/TestBagOfPostings.cs @@ -10,7 +10,6 @@ using System.Text; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs index 649943eccc..5ad4bc3d99 100644 --- a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs +++ b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs @@ -17,7 +17,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestByteSlices.cs b/src/Lucene.Net.Tests/Index/TestByteSlices.cs index 429ca6d575..6c3fdf359f 100644 --- a/src/Lucene.Net.Tests/Index/TestByteSlices.cs +++ b/src/Lucene.Net.Tests/Index/TestByteSlices.cs @@ -1,7 +1,7 @@ using NUnit.Framework; using RandomizedTesting.Generators; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs index 443ea738c0..e9d58192f0 100644 --- a/src/Lucene.Net.Tests/Index/TestCheckIndex.cs +++ b/src/Lucene.Net.Tests/Index/TestCheckIndex.cs @@ -3,12 +3,12 @@ using Lucene.Net.Support.IO; using Lucene.Net.Util; using NUnit.Framework; +using System; using System.Collections.Generic; using System.IO; using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs index 411d878e5c..2402091ba6 100644 --- a/src/Lucene.Net.Tests/Index/TestCodecs.cs +++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs index b74750cc00..3cd7f43009 100644 --- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs +++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs @@ -10,7 +10,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestCrash.cs b/src/Lucene.Net.Tests/Index/TestCrash.cs index a6cc75918f..7b5153c363 100644 --- a/src/Lucene.Net.Tests/Index/TestCrash.cs +++ b/src/Lucene.Net.Tests/Index/TestCrash.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs index 15ad99a3f6..551bf6c3f2 100644 --- a/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs +++ b/src/Lucene.Net.Tests/Index/TestCrashCausesCorruptIndex.cs @@ -4,7 +4,6 @@ using System; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs index 1916037e3b..3321b02c5f 100644 --- a/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestDeletionPolicy.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs index b9eac4c5bf..fb2354aa07 100644 --- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs +++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs @@ -9,7 +9,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs index daeb3926c0..b949665e6e 100644 --- a/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs +++ b/src/Lucene.Net.Tests/Index/TestDirectoryReaderReopen.cs @@ -8,7 +8,6 @@ using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Lucene.Net.Support.Threading; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestDoc.cs b/src/Lucene.Net.Tests/Index/TestDoc.cs index 7d2b8256d0..660863ea44 100644 --- a/src/Lucene.Net.Tests/Index/TestDoc.cs +++ b/src/Lucene.Net.Tests/Index/TestDoc.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs index 05d8a4d9f7..837a2f6aba 100644 --- a/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs +++ b/src/Lucene.Net.Tests/Index/TestDocTermOrds.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs index 3bb8736e83..cfbd9acd0c 100644 --- a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs @@ -8,7 +8,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs index f059dff520..3208a152e8 100644 --- a/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs +++ b/src/Lucene.Net.Tests/Index/TestDocumentsWriterStallControl.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs index 731486f464..98fe1b97fc 100644 --- a/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestFlushByRamOrCountsPolicy.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Lucene.Net.Util; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs index 8703e2e1ad..74d75043bf 100644 --- a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs +++ b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs index e48c12ae2e..2d0d2bc764 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs @@ -18,7 +18,6 @@ using System.IO; using System.Text; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs index 2334859462..2b220d5af6 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterCommit.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs index 6ef9c61802..197935fa9f 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs @@ -16,7 +16,6 @@ using System.Text; using System.Threading; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; // ReSharper disable once RedundantUsingDirective - keep until we have an analyzer to look out for accidental NUnit asserts using Assert = Lucene.Net.TestFramework.Assert; diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs index c62cee0e23..e3b6f0064e 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs @@ -16,7 +16,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs index c7999f3932..f91ee3b50d 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterForceMerge.cs @@ -1,8 +1,8 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs index 5068f7c9fe..9e42ce2a64 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterMerging.cs @@ -10,7 +10,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs index a59c724e19..d8ff8788cb 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterNRTIsCurrent.cs @@ -7,7 +7,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs index 72b48b2afa..7bf7b0167d 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs @@ -7,7 +7,6 @@ using System; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs index 3cdcd2493a..37ecf0f946 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnJRECrash.cs @@ -14,7 +14,6 @@ using System.Threading; using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs index b586a801fb..1bc4147e84 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs index 7c3949dcd0..0bed9be3eb 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs @@ -18,7 +18,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; #endif namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs index 9f5f49ed83..2a6b6f1247 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterWithThreads.cs @@ -11,7 +11,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestIndexableField.cs b/src/Lucene.Net.Tests/Index/TestIndexableField.cs index 5c178fd313..19f0aa3147 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexableField.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexableField.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE using RandomizedTesting.Generators; // for Random.NextSingle extension method diff --git a/src/Lucene.Net.Tests/Index/TestLongPostings.cs b/src/Lucene.Net.Tests/Index/TestLongPostings.cs index 28b8355122..68512d662b 100644 --- a/src/Lucene.Net.Tests/Index/TestLongPostings.cs +++ b/src/Lucene.Net.Tests/Index/TestLongPostings.cs @@ -7,7 +7,6 @@ using System; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs b/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs index d91116e8b4..c4b3e75748 100644 --- a/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs +++ b/src/Lucene.Net.Tests/Index/TestMixedCodecs.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestMultiFields.cs b/src/Lucene.Net.Tests/Index/TestMultiFields.cs index b69cf5226c..f005612247 100644 --- a/src/Lucene.Net.Tests/Index/TestMultiFields.cs +++ b/src/Lucene.Net.Tests/Index/TestMultiFields.cs @@ -7,8 +7,8 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; +using System; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs index baad17d267..121f19e25d 100644 --- a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE using RandomizedTesting.Generators; diff --git a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs index c842e542d9..72fa5a1792 100644 --- a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs +++ b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs @@ -1,10 +1,10 @@ using Lucene.Net.Diagnostics; using NUnit.Framework; using RandomizedTesting.Generators; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestNeverDelete.cs b/src/Lucene.Net.Tests/Index/TestNeverDelete.cs index 1c8bbd61db..f762753d9b 100644 --- a/src/Lucene.Net.Tests/Index/TestNeverDelete.cs +++ b/src/Lucene.Net.Tests/Index/TestNeverDelete.cs @@ -8,7 +8,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs b/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs index 891b1aa691..d512508f5f 100644 --- a/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs +++ b/src/Lucene.Net.Tests/Index/TestParallelReaderEmptyIndex.cs @@ -1,8 +1,8 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs index e1b080690c..1d16e2cd97 100644 --- a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs +++ b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE diff --git a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs index d16d03b697..bda1c2bade 100644 --- a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs +++ b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs @@ -8,7 +8,6 @@ using RandomizedTesting.Generators; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs index 8324102931..3f1cb9eeef 100644 --- a/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestSnapshotDeletionPolicy.cs @@ -7,7 +7,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestStressAdvance.cs b/src/Lucene.Net.Tests/Index/TestStressAdvance.cs index 1b10714801..f74649d21e 100644 --- a/src/Lucene.Net.Tests/Index/TestStressAdvance.cs +++ b/src/Lucene.Net.Tests/Index/TestStressAdvance.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs index dfd8c28c49..83738aea4a 100644 --- a/src/Lucene.Net.Tests/Index/TestStressIndexing.cs +++ b/src/Lucene.Net.Tests/Index/TestStressIndexing.cs @@ -8,7 +8,6 @@ using System; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs index 5da67a1de9..f84792def5 100644 --- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs +++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs @@ -16,7 +16,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestStressNRT.cs b/src/Lucene.Net.Tests/Index/TestStressNRT.cs index 4780a0d860..6943ddafe3 100644 --- a/src/Lucene.Net.Tests/Index/TestStressNRT.cs +++ b/src/Lucene.Net.Tests/Index/TestStressNRT.cs @@ -12,7 +12,6 @@ using System.Globalization; using System.Threading; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs b/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs index 2e20add835..8ad9b44442 100644 --- a/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs +++ b/src/Lucene.Net.Tests/Index/TestSumDocFreq.cs @@ -1,7 +1,7 @@ using Lucene.Net.Documents; using NUnit.Framework; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs b/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs index d5819e6909..781e9c276a 100644 --- a/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs +++ b/src/Lucene.Net.Tests/Index/TestTermdocPerf.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using System; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE using RandomizedTesting.Generators; diff --git a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs index cc8ca18981..e1dfd4d7b9 100644 --- a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs +++ b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Index diff --git a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs index 0158961553..e74cdebb89 100644 --- a/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs +++ b/src/Lucene.Net.Tests/Index/TestThreadedForceMerge.cs @@ -5,7 +5,6 @@ using System; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs b/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs index 17f39863e7..b07766c968 100644 --- a/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestTieredMergePolicy.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { @@ -276,4 +275,4 @@ public virtual void TestSetters() // TODO: Add more checks for other non-double setters! } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests/Index/TestTransactions.cs b/src/Lucene.Net.Tests/Index/TestTransactions.cs index 0604ecedf9..4a4e8ddb05 100644 --- a/src/Lucene.Net.Tests/Index/TestTransactions.cs +++ b/src/Lucene.Net.Tests/Index/TestTransactions.cs @@ -8,7 +8,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs index 8bc77f2d2a..7705718ef7 100644 --- a/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs +++ b/src/Lucene.Net.Tests/Search/Payloads/TestPayloadNearQuery.cs @@ -8,7 +8,6 @@ using System.IO; using System.Text.RegularExpressions; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Payloads { diff --git a/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs b/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs index 9d601c403d..277b9a4ae1 100644 --- a/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs +++ b/src/Lucene.Net.Tests/Search/Spans/TestPayloadSpans.cs @@ -9,7 +9,6 @@ using System.IO; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Spans { diff --git a/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs b/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs index 35635bf32c..982649bff3 100644 --- a/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs +++ b/src/Lucene.Net.Tests/Search/Spans/TestSpansAdvanced.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search.Spans { diff --git a/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs b/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs index c4d8652843..fb867687a2 100644 --- a/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs +++ b/src/Lucene.Net.Tests/Search/TestAutomatonQuery.cs @@ -1,9 +1,9 @@ using J2N.Threading; using Lucene.Net.Documents; using NUnit.Framework; +using System; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/Search/TestBoolean2.cs index 6f7b69d07d..6d54e4e9f0 100644 --- a/src/Lucene.Net.Tests/Search/TestBoolean2.cs +++ b/src/Lucene.Net.Tests/Search/TestBoolean2.cs @@ -5,7 +5,6 @@ using RandomizedTesting.Generators; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs index 1c77c349b7..7b47ff9966 100644 --- a/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs +++ b/src/Lucene.Net.Tests/Search/TestBooleanMinShouldMatch.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using RandomizedTesting.Generators; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs index 1a06b59f76..e51f633c8e 100644 --- a/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs +++ b/src/Lucene.Net.Tests/Search/TestBooleanQuery.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs index 19d119ba35..c66ca5e53a 100644 --- a/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs +++ b/src/Lucene.Net.Tests/Search/TestControlledRealTimeReopenThread.cs @@ -17,7 +17,6 @@ using System.Threading.Tasks; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Lucene.Net.Attributes; namespace Lucene.Net.Search diff --git a/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs b/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs index c10f99745a..1c9d587865 100644 --- a/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs +++ b/src/Lucene.Net.Tests/Search/TestCustomSearcherSort.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search diff --git a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs index db7fb026e8..bb32b7acbf 100644 --- a/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs +++ b/src/Lucene.Net.Tests/Search/TestDisjunctionMaxQuery.cs @@ -4,7 +4,6 @@ using Lucene.Net.Index.Extensions; using NUnit.Framework; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestDocBoost.cs b/src/Lucene.Net.Tests/Search/TestDocBoost.cs index cbef0616c6..5c9a8179db 100644 --- a/src/Lucene.Net.Tests/Search/TestDocBoost.cs +++ b/src/Lucene.Net.Tests/Search/TestDocBoost.cs @@ -1,8 +1,8 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestDocIdSet.cs b/src/Lucene.Net.Tests/Search/TestDocIdSet.cs index 57b8f1262e..3387c79513 100644 --- a/src/Lucene.Net.Tests/Search/TestDocIdSet.cs +++ b/src/Lucene.Net.Tests/Search/TestDocIdSet.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs index d59a1bc54c..2a8e9f1e77 100644 --- a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs +++ b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRangeFilter.cs @@ -4,7 +4,6 @@ using RandomizedTesting.Generators; using System; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs index 4bd5265719..b8b7a2ab86 100644 --- a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs +++ b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs @@ -6,7 +6,6 @@ using System; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs index 390daa7e54..60c515e804 100644 --- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs +++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs @@ -13,7 +13,6 @@ using System.Text; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search diff --git a/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs b/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs index 3c085e967c..5cb694a890 100644 --- a/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs +++ b/src/Lucene.Net.Tests/Search/TestLiveFieldValues.cs @@ -8,7 +8,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE using RandomizedTesting.Generators; diff --git a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs index 135462d8b5..5c4cf34a30 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiPhraseQuery.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs index 3e20bf19ad..eb790a3615 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiTermConstantScore.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs index d4ea426f1f..a1f887cab4 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs index 75ae3621ca..2c685d2df2 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiThreadTermVectors.cs @@ -6,7 +6,6 @@ using System; using System.Text; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs index 326054aa12..0a2f67cd6a 100644 --- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs +++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery32.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs index 23b51420e1..f2ea0d5179 100644 --- a/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs +++ b/src/Lucene.Net.Tests/Search/TestNumericRangeQuery64.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs index f1c3207e24..030215fb42 100644 --- a/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs +++ b/src/Lucene.Net.Tests/Search/TestPositionIncrement.cs @@ -6,7 +6,6 @@ using System.IO; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs index 7730df0664..030e1eb37b 100644 --- a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs +++ b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs @@ -5,7 +5,6 @@ using RandomizedTesting.Generators; using System; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs index 15ae8cce01..291a58206e 100644 --- a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs +++ b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs @@ -4,7 +4,6 @@ using System; using Assert = Lucene.Net.TestFramework.Assert; using BitSet = J2N.Collections.BitSet; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs index 0df57a5e75..cb9b3c2054 100644 --- a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs +++ b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs @@ -7,7 +7,6 @@ using System.Globalization; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs b/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs index e2b924cc07..a05e4758d8 100644 --- a/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs +++ b/src/Lucene.Net.Tests/Search/TestSearchWithThreads.cs @@ -6,7 +6,6 @@ using System; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs index 932a4e196a..c0e4543dc4 100644 --- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs +++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs @@ -10,7 +10,6 @@ using System.Threading; using System.Threading.Tasks; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestShardSearching.cs b/src/Lucene.Net.Tests/Search/TestShardSearching.cs index da0aa18017..77520b553f 100644 --- a/src/Lucene.Net.Tests/Search/TestShardSearching.cs +++ b/src/Lucene.Net.Tests/Search/TestShardSearching.cs @@ -1,9 +1,9 @@ using J2N.Collections.Generic.Extensions; using NUnit.Framework; using RandomizedTesting.Generators; +using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Search diff --git a/src/Lucene.Net.Tests/Search/TestSortRandom.cs b/src/Lucene.Net.Tests/Search/TestSortRandom.cs index 973d7e85e6..632b902711 100644 --- a/src/Lucene.Net.Tests/Search/TestSortRandom.cs +++ b/src/Lucene.Net.Tests/Search/TestSortRandom.cs @@ -6,7 +6,6 @@ using System.Linq; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomizedTesting.Generators; namespace Lucene.Net.Search diff --git a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs index 88fb8dbf52..72f06a5180 100644 --- a/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs +++ b/src/Lucene.Net.Tests/Search/TestTimeLimitingCollector.cs @@ -11,7 +11,6 @@ using NUnit.Framework; using System; using System.Text.RegularExpressions; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs index f492ce6101..1925cc088e 100644 --- a/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs +++ b/src/Lucene.Net.Tests/Search/TestTopDocsMerge.cs @@ -7,7 +7,6 @@ using System.Text; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestWildcard.cs b/src/Lucene.Net.Tests/Search/TestWildcard.cs index b0d9762d9e..c8ef04ec94 100644 --- a/src/Lucene.Net.Tests/Search/TestWildcard.cs +++ b/src/Lucene.Net.Tests/Search/TestWildcard.cs @@ -1,8 +1,8 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; +using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs b/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs index 61d7b552df..5d90304876 100644 --- a/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs +++ b/src/Lucene.Net.Tests/Search/TestWildcardRandom.cs @@ -1,9 +1,9 @@ using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; +using System; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Search { diff --git a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs index 4ff093a951..1520cf05fa 100644 --- a/src/Lucene.Net.Tests/Store/TestCopyBytes.cs +++ b/src/Lucene.Net.Tests/Store/TestCopyBytes.cs @@ -4,7 +4,6 @@ using RandomizedTesting.Generators; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs index e74fffbdf1..0a10ec1b7b 100644 --- a/src/Lucene.Net.Tests/Store/TestDirectory.cs +++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs @@ -10,7 +10,6 @@ using System.Threading; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs index 4a7301220b..36e1a22610 100644 --- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs +++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs @@ -7,7 +7,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs index 8e097ef569..c25c3d5999 100644 --- a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs +++ b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs @@ -4,7 +4,6 @@ using System.IO; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Lucene.Net.Attributes; namespace Lucene.Net.Store diff --git a/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs b/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs index 21bc3f56fc..5ba0faf677 100644 --- a/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs +++ b/src/Lucene.Net.Tests/Support/Threading/ReentrantLockTest.cs @@ -11,7 +11,6 @@ using System.Threading; using System.Threading.Tasks; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Support.Threading { diff --git a/src/Lucene.Net.Tests/TestExternalCodecs.cs b/src/Lucene.Net.Tests/TestExternalCodecs.cs index 5411d25b1c..65070115f5 100644 --- a/src/Lucene.Net.Tests/TestExternalCodecs.cs +++ b/src/Lucene.Net.Tests/TestExternalCodecs.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net { diff --git a/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs b/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs index 4d57032373..2763020442 100644 --- a/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs +++ b/src/Lucene.Net.Tests/TestMergeSchedulerExternal.cs @@ -7,7 +7,6 @@ using System.IO; using System.Threading; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net { diff --git a/src/Lucene.Net.Tests/TestSearch.cs b/src/Lucene.Net.Tests/TestSearch.cs index c3e0960f20..8d496aa939 100644 --- a/src/Lucene.Net.Tests/TestSearch.cs +++ b/src/Lucene.Net.Tests/TestSearch.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Occur = Lucene.Net.Search.Occur; using StringWriter = System.IO.StringWriter; diff --git a/src/Lucene.Net.Tests/TestSearchForDuplicates.cs b/src/Lucene.Net.Tests/TestSearchForDuplicates.cs index 43d713bb3f..151740a9f4 100644 --- a/src/Lucene.Net.Tests/TestSearchForDuplicates.cs +++ b/src/Lucene.Net.Tests/TestSearchForDuplicates.cs @@ -7,7 +7,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using StringWriter = System.IO.StringWriter; using TextWriter = System.IO.TextWriter; diff --git a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs index f55400011b..1f6fab49ff 100644 --- a/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs +++ b/src/Lucene.Net.Tests/TestWorstCaseTestBehavior.cs @@ -3,7 +3,6 @@ using NUnit.Framework; using System; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net { diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs index 9879c64749..4dd5179f18 100644 --- a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs +++ b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using JCG = J2N.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using RandomInts = RandomizedTesting.Generators.RandomNumbers; namespace Lucene.Net.Util.Automaton diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs b/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs index f882b146af..d02437e67e 100644 --- a/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs +++ b/src/Lucene.Net.Tests/Util/Automaton/TestCompiledAutomaton.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Util.Automaton diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs index 42e7125b24..ef2fa03e7e 100644 --- a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs +++ b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs @@ -6,7 +6,6 @@ using System; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util.Automaton { diff --git a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs index ff321b8367..69dab53413 100644 --- a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs +++ b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using Int64 = J2N.Numerics.Int64; #if !FEATURE_RANDOM_NEXTINT64_NEXTSINGLE diff --git a/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs b/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs index 3f0bc46638..9d90aaba3d 100644 --- a/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs +++ b/src/Lucene.Net.Tests/Util/Fst/TestBytesStore.cs @@ -3,7 +3,6 @@ using RandomizedTesting.Generators; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util.Fst { diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs index f8b1b89a18..55465090b3 100644 --- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs +++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs @@ -12,7 +12,6 @@ using System.IO; using System.Text; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; using Int64 = J2N.Numerics.Int64; diff --git a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs index ef01e20214..2009f8f164 100644 --- a/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs +++ b/src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Globalization; using JCG = J2N.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using RandomInts = RandomizedTesting.Generators.RandomNumbers; namespace Lucene.Net.Util.Packed diff --git a/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs b/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs index 523ff68936..661955812d 100644 --- a/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs +++ b/src/Lucene.Net.Tests/Util/StressRamUsageEstimator.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using System; using System.Globalization; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs index 68dcc7ccd5..16e5819ed6 100644 --- a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs +++ b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs @@ -3,7 +3,6 @@ using RandomizedTesting.Generators; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestConstants.cs b/src/Lucene.Net.Tests/Util/TestConstants.cs index 7eafb70f2e..666afe3836 100644 --- a/src/Lucene.Net.Tests/Util/TestConstants.cs +++ b/src/Lucene.Net.Tests/Util/TestConstants.cs @@ -2,7 +2,6 @@ using System; using System.Text.RegularExpressions; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs b/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs index 05c4b323b4..58c9f8161d 100644 --- a/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs +++ b/src/Lucene.Net.Tests/Util/TestFieldCacheSanityChecker.cs @@ -1,10 +1,10 @@ using Lucene.Net.Documents; using Lucene.Net.Search; using NUnit.Framework; +using System; using System.Globalization; using System.IO; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs b/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs index 13999d8260..9df3c22f29 100644 --- a/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs +++ b/src/Lucene.Net.Tests/Util/TestPriorityQueue.cs @@ -9,7 +9,6 @@ using System.Runtime.Serialization.Formatters.Binary; #endif using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs b/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs index de30241f28..fcf0a9a298 100644 --- a/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs +++ b/src/Lucene.Net.Tests/Util/TestRollingBuffer.cs @@ -1,7 +1,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs b/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs index bb8e736a7c..af63fe9d79 100644 --- a/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs +++ b/src/Lucene.Net.Tests/Util/TestUnicodeUtil.cs @@ -4,7 +4,6 @@ using NUnit.Framework; using System; using Assert = Lucene.Net.TestFramework.Assert; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs index 26a5b54a7a..b813a9191c 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs @@ -5,7 +5,6 @@ using Lucene.Net.Util; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Codecs.Lucene3x @@ -48,7 +47,7 @@ namespace Lucene.Net.Codecs.Lucene3x /// /// Exposes flex API on a pre-flex index, as a codec. /// - /// @lucene.experimental + /// @lucene.experimental /// [Obsolete("(4.0)")] internal class Lucene3xFields : FieldsProducer @@ -777,7 +776,7 @@ internal virtual void Reset(FieldInfo fieldInfo) { //System.out.println("pff.reset te=" + termEnum); this.fieldInfo = fieldInfo; - + internedFieldName = fieldInfo.Name.Intern(); Term term = new Term(internedFieldName); @@ -1232,4 +1231,4 @@ public override void CheckIntegrity() { } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs index f06bd1fe18..a5837af526 100644 --- a/src/Lucene.Net/Index/CheckIndex.cs +++ b/src/Lucene.Net/Index/CheckIndex.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.IO; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; using Integer = J2N.Numerics.Int32; using JCG = J2N.Collections.Generic; diff --git a/src/Lucene.Net/Index/IndexUpgrader.cs b/src/Lucene.Net/Index/IndexUpgrader.cs index ae1e3cdafb..78979cf383 100644 --- a/src/Lucene.Net/Index/IndexUpgrader.cs +++ b/src/Lucene.Net/Index/IndexUpgrader.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.IO; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Index { diff --git a/src/Lucene.Net/Store/LockStressTest.cs b/src/Lucene.Net/Store/LockStressTest.cs index 1ef271052f..20a3156cab 100644 --- a/src/Lucene.Net/Store/LockStressTest.cs +++ b/src/Lucene.Net/Store/LockStressTest.cs @@ -6,7 +6,6 @@ using System.Net.Sockets; using System.Text; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net/Store/LockVerifyServer.cs b/src/Lucene.Net/Store/LockVerifyServer.cs index 876da8ebc9..6118978761 100644 --- a/src/Lucene.Net/Store/LockVerifyServer.cs +++ b/src/Lucene.Net/Store/LockVerifyServer.cs @@ -8,7 +8,6 @@ using System.Net.Sockets; using System.Text; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Store { diff --git a/src/Lucene.Net/Store/NRTCachingDirectory.cs b/src/Lucene.Net/Store/NRTCachingDirectory.cs index 55ee2b3d82..bd3af979de 100644 --- a/src/Lucene.Net/Store/NRTCachingDirectory.cs +++ b/src/Lucene.Net/Store/NRTCachingDirectory.cs @@ -2,7 +2,6 @@ using Lucene.Net.Support.Threading; using System; using System.Collections.Generic; -using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; namespace Lucene.Net.Store @@ -307,7 +306,7 @@ public override IndexInput OpenInput(string name, IOContext context) { Console.WriteLine("nrtdir.openInput name=" + name); } - + #pragma warning disable 612, 618 if (cache.FileExists(name)) #pragma warning restore 612, 618 @@ -460,4 +459,4 @@ private void UnCache(string fileName) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Support/Util/SystemConsole.cs b/src/Lucene.Net/Support/Util/SystemConsole.cs deleted file mode 100644 index 5dd841f565..0000000000 --- a/src/Lucene.Net/Support/Util/SystemConsole.cs +++ /dev/null @@ -1,411 +0,0 @@ -using System; -using System.IO; -using System.Runtime.CompilerServices; -#if FEATURE_CODE_ACCESS_SECURITY -using System.Security.Permissions; -#endif - -namespace Lucene.Net.Util -{ - /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /// - /// Mimics , but allows for swapping - /// the of - /// and - /// with user-defined implementations. - /// - public static class SystemConsole - { - public static TextWriter Out { get; set; } = TextWriter.Null; - public static TextWriter Error { get; set; } = TextWriter.Null; - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(bool value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(char value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(char[] buffer) - { - Out.Write(buffer); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(decimal value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(double value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(int value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(long value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(object value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(float value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(uint value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(ulong value) - { - Out.Write(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string format, object arg0) - { - Out.Write(format, arg0); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string format, params object[] arg) - { - if (arg is null) - { - Out.Write(format, null, null); - } - else - { - Out.Write(format, arg); - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(char[] buffer, int index, int count) - { - Out.Write(buffer, index, count); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string format, object arg0, object arg1) - { - Out.Write(format, arg0, arg1); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string format, object arg0, object arg1, object arg2) - { - Out.Write(format, arg0, arg1, arg2); - } - -#if FEATURE_ARGITERATOR - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void Write(string format, object arg0, object arg1, object arg2, object arg3, __arglist) - { - ArgIterator iterator = new ArgIterator(__arglist); - int num = iterator.GetRemainingCount() + 4; - object[] arg = new object[num]; - arg[0] = arg0; - arg[1] = arg1; - arg[2] = arg2; - arg[3] = arg3; - for (int i = 4; i < num; i++) - { - arg[i] = TypedReference.ToObject(iterator.GetNextArg()); - } - Out.Write(format, arg); - } -#endif - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine() - { - Out.WriteLine(); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(bool value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(char value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(char[] buffer) - { - Out.WriteLine(buffer); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(decimal value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(double value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(int value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(long value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(object value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(float value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(uint value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(ulong value) - { - Out.WriteLine(value); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string format, object arg0) - { - Out.WriteLine(format, arg0); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string format, params object[] arg) - { - if (arg is null) - { - Out.WriteLine(format, null, null); - } - else - { - Out.WriteLine(format, arg); - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(char[] buffer, int index, int count) - { - Out.WriteLine(buffer, index, count); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string format, object arg0, object arg1) - { - Out.WriteLine(format, arg0, arg1); - } - - [MethodImpl(MethodImplOptions.NoInlining)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string format, object arg0, object arg1, object arg2) - { - Out.WriteLine(format, arg0, arg1, arg2); - } - -#if FEATURE_ARGITERATOR - [MethodImpl(MethodImplOptions.NoInlining), CLSCompliant(false)] -#if FEATURE_CODE_ACCESS_SECURITY - [HostProtection(SecurityAction.LinkDemand, UI = true)] -#endif - public static void WriteLine(string format, object arg0, object arg1, object arg2, object arg3, __arglist) - { - ArgIterator iterator = new ArgIterator(__arglist); - int num = iterator.GetRemainingCount() + 4; - object[] arg = new object[num]; - arg[0] = arg0; - arg[1] = arg1; - arg[2] = arg2; - arg[3] = arg3; - for (int i = 4; i < num; i++) - { - arg[i] = TypedReference.ToObject(iterator.GetNextArg()); - } - Out.WriteLine(format, arg); - } -#endif - } -} diff --git a/src/Lucene.Net/Util/PrintStreamInfoStream.cs b/src/Lucene.Net/Util/PrintStreamInfoStream.cs index 451586e7f6..804d01e507 100644 --- a/src/Lucene.Net/Util/PrintStreamInfoStream.cs +++ b/src/Lucene.Net/Util/PrintStreamInfoStream.cs @@ -4,7 +4,6 @@ using System.IO; using System.Runtime.CompilerServices; using System.Threading; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Util { @@ -95,4 +94,4 @@ protected override void Dispose(bool disposing) public virtual bool IsSystemStream => isSystemStream; } -} \ No newline at end of file +} diff --git a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs index 0b920e1adc..4886bd170e 100644 --- a/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs +++ b/src/dotnet/tools/lucene-cli/CommandLine/CommandLineApplication.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Console = Lucene.Net.Util.SystemConsole; namespace Lucene.Net.Cli.CommandLine { @@ -570,4 +569,4 @@ public void Reset() } } } -} \ No newline at end of file +} diff --git a/src/dotnet/tools/lucene-cli/Program.cs b/src/dotnet/tools/lucene-cli/Program.cs index 77c548f4ff..529018f0d5 100644 --- a/src/dotnet/tools/lucene-cli/Program.cs +++ b/src/dotnet/tools/lucene-cli/Program.cs @@ -25,10 +25,6 @@ public static class Program { public static int Main(string[] args) { - // Enable console output - SystemConsole.Out = Console.Out; - SystemConsole.Error = Console.Error; - var configuration = new ConfigurationBuilder() .AddEnvironmentVariables(prefix: "lucene:") // Use a custom prefix to only load Lucene.NET settings .AddJsonFile("appsettings.json", optional: true)