This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 486a3045aa4e3eb3852514def3790ff42d0a42f7 Author: Shad Storhaug <[email protected]> AuthorDate: Wed Nov 11 14:33:58 2020 +0700 Fixed compiler warnings --- .../Support/TagSoup/HTMLScanner.cs | 30 ++++++++++++---------- .../Spell/TestLuceneDictionary.cs | 11 ++------ .../Index/TestPersistentSnapshotDeletionPolicy.cs | 2 +- src/Lucene.Net.Tests/Support/TestOldPatches.cs | 3 ++- src/Lucene.Net.Tests/Support/TestSerialization.cs | 2 ++ 5 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/HTMLScanner.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/HTMLScanner.cs index 62833ae..54e3f1d 100644 --- a/src/Lucene.Net.Benchmark/Support/TagSoup/HTMLScanner.cs +++ b/src/Lucene.Net.Benchmark/Support/TagSoup/HTMLScanner.cs @@ -1,4 +1,4 @@ -// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan. +// This file is part of TagSoup and is Copyright 2002-2008 by John Cowan. // // TagSoup is licensed under the Apache License, // Version 2.0. You may obtain a copy of this license at @@ -17,6 +17,7 @@ using Sax; using System; using System.Globalization; using System.IO; +using System.Text; namespace TagSoup { @@ -716,19 +717,20 @@ namespace TagSoup theOutputBuffer[theSize++] = (char)ch; } - /** - Test procedure. Reads HTML from the standard input and writes - PYX to the standard output. - */ - - // public static void main(string[] argv) { - // IScanner s = new HTMLScanner(); - // TextReader r = new StreamReader(System.in, "UTF-8"); - // TextWriter w = new StreamWriter(System.out, "UTF-8"); - // PYXWriter pw = new PYXWriter(w); - // s.scan(r, pw); - // w.close(); - // } + ///// <summary> + ///// Test procedure. Reads HTML from the standard input and writes + ///// PYX to the standard output. + ///// </summary> + ///// <param name="argv"></param> + //[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Optional argument")] + //public static void Main(string[] argv) + //{ + // IScanner s = new HTMLScanner(); + // TextReader r = Console.In; + // TextWriter w = Console.Out; + // PYXWriter pw = new PYXWriter(w); + // s.Scan(r, pw); + //} //private static string NiceChar(int value) // LUCENENET: IDE0051: Remove unused private member diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs index df48dfe..ba4b0dd 100644 --- a/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs +++ b/src/Lucene.Net.Tests.Suggest/Spell/TestLuceneDictionary.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Analysis; +using Lucene.Net.Analysis; using Lucene.Net.Attributes; using Lucene.Net.Documents; using Lucene.Net.Index; @@ -37,9 +37,7 @@ namespace Lucene.Net.Search.Spell private IndexReader indexReader = null; private LuceneDictionary ld; -#pragma warning disable CS0618 // Type or member is obsolete - private IBytesRefIterator it; -#pragma warning restore CS0618 // Type or member is obsolete + private IBytesRefEnumerator it; private BytesRef spare = new BytesRef(); @@ -86,7 +84,6 @@ namespace Lucene.Net.Search.Spell [Test] public void TestFieldNonExistent() { - IBytesRefEnumerator it; try { indexReader = DirectoryReader.Open(store); @@ -105,7 +102,6 @@ namespace Lucene.Net.Search.Spell [Test] public void TestFieldAaa() { - IBytesRefEnumerator it; try { indexReader = DirectoryReader.Open(store); @@ -125,7 +121,6 @@ namespace Lucene.Net.Search.Spell [Test] public void TestFieldContents_1() { - IBytesRefEnumerator it; try { indexReader = DirectoryReader.Open(store); @@ -159,7 +154,6 @@ namespace Lucene.Net.Search.Spell [Test] public void TestFieldContents_2() { - IBytesRefEnumerator it; try { indexReader = DirectoryReader.Open(store); @@ -183,7 +177,6 @@ namespace Lucene.Net.Search.Spell [Test] public void TestFieldZzz() { - IBytesRefEnumerator it; try { indexReader = DirectoryReader.Open(store); diff --git a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs index d5fcc54..1808768 100644 --- a/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs +++ b/src/Lucene.Net.Tests/Index/TestPersistentSnapshotDeletionPolicy.cs @@ -144,7 +144,7 @@ namespace Lucene.Net.Index } else { - throw ioe; + throw; // LUCENENET: CA2200: Rethrow to preserve stack details } } Assert.AreEqual(0, psdp.SnapshotCount); diff --git a/src/Lucene.Net.Tests/Support/TestOldPatches.cs b/src/Lucene.Net.Tests/Support/TestOldPatches.cs index ab5b0cb..26b9c38 100644 --- a/src/Lucene.Net.Tests/Support/TestOldPatches.cs +++ b/src/Lucene.Net.Tests/Support/TestOldPatches.cs @@ -63,12 +63,13 @@ namespace Lucene.Net.Support //now serialize it System.Runtime.Serialization.Formatters.Binary.BinaryFormatter serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); +#pragma warning disable SYSLIB0011 // Type or member is obsolete (BinaryFormatter) serializer.Serialize(memoryStream, queryPreSerialized); //now deserialize memoryStream.Seek(0, System.IO.SeekOrigin.Begin); Lucene.Net.Search.BooleanQuery queryPostSerialized = (Lucene.Net.Search.BooleanQuery)serializer.Deserialize(memoryStream); - +#pragma warning restore SYSLIB0011 // Type or member is obsolete (BinaryFormatter) memoryStream.Close(); Assert.AreEqual(queryPreSerialized, queryPostSerialized, "See the issue: LUCENENET-170"); diff --git a/src/Lucene.Net.Tests/Support/TestSerialization.cs b/src/Lucene.Net.Tests/Support/TestSerialization.cs index 5630a5a..a61e561 100644 --- a/src/Lucene.Net.Tests/Support/TestSerialization.cs +++ b/src/Lucene.Net.Tests/Support/TestSerialization.cs @@ -81,9 +81,11 @@ namespace Lucene.Net.Support System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream ms = new System.IO.MemoryStream(); +#pragma warning disable SYSLIB0011 // Type or member is obsolete (BinaryFormatter) bf.Serialize(ms, lucQuery); ms.Seek(0, System.IO.SeekOrigin.Begin); Lucene.Net.Search.BooleanQuery lucQuery2 = (Lucene.Net.Search.BooleanQuery)bf.Deserialize(ms); +#pragma warning restore SYSLIB0011 // Type or member is obsolete (BinaryFormatter) ms.Close(); Assert.AreEqual(lucQuery, lucQuery2, "Error in serialization");
