diff --git a/.build/runbuild.ps1 b/.build/runbuild.ps1 index 4fad5efe5d..c0204c47a0 100644 --- a/.build/runbuild.ps1 +++ b/.build/runbuild.ps1 @@ -109,6 +109,7 @@ task Init -depends CheckSDK, UpdateLocalSDKVersion -description "This task makes Write-Host "Powershell Version: $($PSVersionTable.PSVersion)" Ensure-Directory-Exists "$artifactsDirectory" + Ensure-Directory-Exists "$nugetPackageDirectory" # helpful when adding this path to your nuget sources for local installs } task Restore -description "This task restores the dependencies" { diff --git a/Directory.Build.targets b/Directory.Build.targets index b0bcc3b8c3..187d31b921 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -31,6 +31,7 @@ $(DefineConstants);FEATURE_RANDOM_NEXTINT64_NEXTSINGLE $(DefineConstants);FEATURE_SPANFORMATTABLE + $(DefineConstants);FEATURE_SUPPORTEDOSPLATFORMATTRIBUTE diff --git a/TestTargetFramework.props b/TestTargetFramework.props index 023e64dc36..a98107864f 100644 --- a/TestTargetFramework.props +++ b/TestTargetFramework.props @@ -23,7 +23,7 @@ - @@ -38,7 +38,7 @@ false + true $(NoWarn);CA1034 $(NoWarn);CA1802 diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs index e03cc80430..2665f69409 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs @@ -1,6 +1,5 @@ // Lucene version compatibility level 4.10.4 using J2N; -using J2N.Collections.Generic.Extensions; using J2N.Numerics; using J2N.Text; using Lucene.Net.Diagnostics; @@ -726,11 +725,11 @@ internal static string GetDictionaryEncoding(Stream affix) internal static readonly IDictionary CHARSET_ALIASES = LoadCharsetAliases(); private static IDictionary LoadCharsetAliases() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006) { - return new Dictionary + return Collections.AsReadOnly(new Dictionary { ["microsoft-cp1251"] = "windows-1251", ["TIS620-2533"] = "TIS-620" - }.AsReadOnly(); + }); } /// diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs index 5afe7c5c57..9839b027d4 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs @@ -1,5 +1,4 @@ // Lucene version compatibility level 4.8.1 -using J2N.Collections.Generic.Extensions; using Lucene.Net.Analysis.Core; using Lucene.Net.Support; using Lucene.Net.Util; @@ -38,7 +37,7 @@ namespace Lucene.Net.Analysis.Util /// The typical lifecycle for a factory consumer is: /// /// Create factory via its constructor (or via XXXFactory.ForName) - /// (Optional) If the factory uses resources such as files, + /// (Optional) If the factory uses resources such as files, /// is called to initialize those resources. /// Consumer calls create() to obtain instances. /// @@ -62,7 +61,7 @@ public abstract class AbstractAnalysisFactory protected AbstractAnalysisFactory(IDictionary args) { IsExplicitLuceneMatchVersion = false; - originalArgs = args.AsReadOnly(); + originalArgs = Collections.AsReadOnly(args); string version = Get(args, LUCENE_MATCH_VERSION_PARAM); // LUCENENET TODO: What should we do if the version is null? //luceneMatchVersion = version is null ? (LuceneVersion?)null : LuceneVersionHelpers.ParseLeniently(version); @@ -79,7 +78,7 @@ protected AbstractAnalysisFactory(IDictionary args) /// /// this method can be called in the /// or methods, - /// to inform user, that for this factory a is required + /// to inform user, that for this factory a is required /// [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "By design")] protected void AssureMatchVersion() // LUCENENET TODO: Remove this method (not used anyway in .NET) @@ -296,7 +295,7 @@ public virtual ISet GetSet(IDictionary args, string name } /// - /// Compiles a pattern for the value of the specified argument key + /// Compiles a pattern for the value of the specified argument key /// protected Regex GetPattern(IDictionary args, string name) { @@ -372,7 +371,7 @@ protected IList GetLines(IResourceLoader loader, string resource) /// /// Same as , - /// except the input is in snowball format. + /// except the input is in snowball format. /// protected CharArraySet GetSnowballWordSet(IResourceLoader loader, string wordFiles, bool ignoreCase) { @@ -428,7 +427,7 @@ private static class SplitFileNameHolder private const string CLASS_NAME = "class"; - /// the string used to specify the concrete class name in a serialized representation: the class arg. + /// the string used to specify the concrete class name in a serialized representation: the class arg. /// If the concrete class name was not specified via a class arg, returns GetType().Name. public virtual string GetClassArg() { @@ -445,4 +444,4 @@ public virtual string GetClassArg() public virtual bool IsExplicitLuceneMatchVersion { get; set; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs index 5b493f5a09..f362acd0cf 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs @@ -1,5 +1,4 @@ // Lucene version compatibility level 4.8.1 -using J2N.Collections.Generic.Extensions; using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; @@ -98,7 +97,7 @@ public void Reload() services.Add(name, service); } } - this.services = services.AsReadOnly(); + this.services = Collections.AsReadOnly(services); } finally { @@ -136,4 +135,4 @@ public Type LookupClass(string name) public ICollection AvailableServices => services.Keys; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj b/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj index 5a64acc9e1..f832a424e0 100644 --- a/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj +++ b/src/Lucene.Net.Analysis.Common/Lucene.Net.Analysis.Common.csproj @@ -26,11 +26,11 @@ Analyzers for indexing content in different languages and domains for the Lucene.NET full-text search engine library from The Apache Software Foundation. analysis-common/overview.html - + - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.Common $(PackageTags);analysis @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj b/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj index 463cd17cc3..4d7dbd38bc 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj +++ b/src/Lucene.Net.Analysis.Kuromoji/Lucene.Net.Analysis.Kuromoji.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.Kuromoji $(PackageTags);analysis;japanese @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Analysis.Morfologik/Lucene.Net.Analysis.Morfologik.csproj b/src/Lucene.Net.Analysis.Morfologik/Lucene.Net.Analysis.Morfologik.csproj index fe435a6e05..6c1316b3b6 100644 --- a/src/Lucene.Net.Analysis.Morfologik/Lucene.Net.Analysis.Morfologik.csproj +++ b/src/Lucene.Net.Analysis.Morfologik/Lucene.Net.Analysis.Morfologik.csproj @@ -26,11 +26,11 @@ Analyzer for dictionary stemming, built-in Polish dictionary for the Lucene.NET full-text search engine library from The Apache Software Foundation. analysis-morfologik/Lucene.Net.Analysis.Morfologik.html - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.Morfologik Lucene.Net.Analysis @@ -39,7 +39,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Analysis.OpenNLP/Lucene.Net.Analysis.OpenNLP.csproj b/src/Lucene.Net.Analysis.OpenNLP/Lucene.Net.Analysis.OpenNLP.csproj index c8a8759bdc..7ca0c855e7 100644 --- a/src/Lucene.Net.Analysis.OpenNLP/Lucene.Net.Analysis.OpenNLP.csproj +++ b/src/Lucene.Net.Analysis.OpenNLP/Lucene.Net.Analysis.OpenNLP.csproj @@ -32,7 +32,7 @@ - net6.0 + net8.0;net6.0 $(TargetFrameworks);net472 Lucene.Net.Analysis.OpenNLP diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs index 57e7cdbfe2..863213baef 100644 --- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs +++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs @@ -1,7 +1,7 @@ // commons-codec version compatibility level: 1.9 using J2N; -using J2N.Collections.Generic.Extensions; using J2N.Text; +using Lucene.Net.Support; using System; using System.Collections.Generic; using System.IO; @@ -218,7 +218,7 @@ public static Lang LoadFromResource(string languageRulesResourceName, Languages private Lang(IList rules, Languages languages) { - this.rules = rules.AsReadOnly(); + this.rules = Collections.AsReadOnly(rules); this.languages = languages; } diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs index 97130dcf3d..fb2b53fbd6 100644 --- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs +++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs @@ -1,6 +1,5 @@ // commons-codec version compatibility level: 1.9 using J2N; -using J2N.Collections.Generic.Extensions; using J2N.Text; using Lucene.Net.Support; using Lucene.Net.Util; @@ -150,10 +149,10 @@ private static IDictionaryThe int position within the input. /// true if the pattern and left/right context match, false otherwise. // LUCENENET specific - public virtual bool PatternAndContextMatches(string input, int i) + public virtual bool PatternAndContextMatches(string input, int i) { if (i < 0) { @@ -940,7 +939,7 @@ public virtual bool PatternAndContextMatches(StringBuilder input, int i) public sealed class Phoneme : IPhonemeExpr { - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE [Serializable] diff --git a/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj b/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj index 2270760887..6edefcfe05 100644 --- a/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj +++ b/src/Lucene.Net.Analysis.Phonetic/Lucene.Net.Analysis.Phonetic.csproj @@ -30,7 +30,7 @@ - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.Phonetic $(PackageTags);analysis;soundex;double;metaphone;sounds;like;beider;morse;cologne;caverphone;nysiis;match;rating @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj b/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj index a5015f2d16..dc850a399a 100644 --- a/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj +++ b/src/Lucene.Net.Analysis.SmartCn/Lucene.Net.Analysis.SmartCn.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.SmartCn $(PackageTags);analysis;chinese;smart @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj index a394d18288..dca9b4a6f5 100644 --- a/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj +++ b/src/Lucene.Net.Analysis.Stempel/Lucene.Net.Analysis.Stempel.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Analysis.Stempel $(PackageTags);analysis;polish @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj index 250ca43a37..ac73b98930 100644 --- a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj +++ b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj @@ -26,11 +26,11 @@ System for benchmarking the Lucene.NET full-text search engine library from The Apache Software Foundation. benchmark/Lucene.Net.Benchmarks.html - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Benchmark $(PackageTags);benchmark @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj b/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj index 3a8b15646c..ef3e8b72bc 100644 --- a/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj +++ b/src/Lucene.Net.Classification/Lucene.Net.Classification.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Classification $(PackageTags);classification @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj index 1db2df0782..38c977d06e 100644 --- a/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj +++ b/src/Lucene.Net.Codecs/Lucene.Net.Codecs.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Codecs $(PackageTags);codec @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj b/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj index 4381bbb968..4c616682ec 100644 --- a/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj +++ b/src/Lucene.Net.Demo/Lucene.Net.Demo.csproj @@ -22,20 +22,20 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Demo Simple example code for the Lucene.Net full-text search engine library from The Apache Software Foundation. $(PackageTags);demo bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + $(NoWarn);1591;1573 $(NoWarn);IDE0060 - + diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs index 0b9c7943c1..7dea0c0a40 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs @@ -1,5 +1,4 @@ -using J2N.Collections.Generic.Extensions; -using J2N.Text; +using J2N.Text; using Antlr.Runtime; using Antlr.Runtime.Tree; using Lucene.Net.Queries.Function; @@ -97,7 +96,7 @@ private static MethodInfo GetMethod(Type type, string method, Type[] parms) private readonly IDictionary functions; - + private ILGenerator gen; private AssemblyBuilder asmBuilder; @@ -202,7 +201,7 @@ private void BeginCompile() dynamicType = modBuilder.DefineType(COMPILED_EXPRESSION_CLASS, TypeAttributes.AnsiClass | TypeAttributes.AutoClass | TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.BeforeFieldInit | TypeAttributes.AutoLayout, EXPRESSION_TYPE); - + ConstructorBuilder constructorBuilder = dynamicType.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, new[] { typeof(string), typeof(string[]) }); @@ -634,7 +633,7 @@ private static IDictionary LoadDefaultFunctions() // LUCENEN { throw Error.Create("Cannot resolve function", e); } - return map.AsReadOnly(); + return Collections.AsReadOnly(map); } private static Type GetType(string typeName) diff --git a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj index d32f09fd6e..0c62f265fd 100644 --- a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj +++ b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Expressions $(PackageTags);expression @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + @@ -51,13 +51,13 @@ - + - + diff --git a/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj b/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj index 2406b72f5a..ec61433d6d 100644 --- a/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj +++ b/src/Lucene.Net.Facet/Lucene.Net.Facet.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Facet $(PackageTags);facet;faceted diff --git a/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj b/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj index 9d11ecd511..1a0c3c2ada 100644 --- a/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj +++ b/src/Lucene.Net.Grouping/Lucene.Net.Grouping.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Grouping $(PackageTags);grouping;group @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj index a1a2ac2c0c..ba96f09504 100644 --- a/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj +++ b/src/Lucene.Net.Highlighter/Lucene.Net.Highlighter.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Highlighter $(PackageTags);highlight;highlighter @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Join/Lucene.Net.Join.csproj b/src/Lucene.Net.Join/Lucene.Net.Join.csproj index a85cd5ae8e..86ba93956f 100644 --- a/src/Lucene.Net.Join/Lucene.Net.Join.csproj +++ b/src/Lucene.Net.Join/Lucene.Net.Join.csproj @@ -28,19 +28,19 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Search.Join - + Lucene.Net.Join $(PackageTags);join bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj b/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj index d373b3dc76..433641f028 100644 --- a/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj +++ b/src/Lucene.Net.Memory/Lucene.Net.Memory.csproj @@ -28,17 +28,17 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 - + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 + Lucene.Net.Memory $(PackageTags);memory bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj b/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj index 42e2679762..4aa45cc0cb 100644 --- a/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj +++ b/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Misc $(PackageTags);miscellaneous @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj index 90833c84bf..d8718a3c45 100644 --- a/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj +++ b/src/Lucene.Net.Queries/Lucene.Net.Queries.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Queries $(PackageTags);query;queries @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj b/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj index fe8ba4d3ba..9111ebd2bb 100644 --- a/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj +++ b/src/Lucene.Net.QueryParser/Lucene.Net.QueryParser.csproj @@ -28,22 +28,22 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.QueryParsers - + Lucene.Net.QueryParser $(PackageTags);query;queryparser bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + $(NoWarn);1591;1573 $(NoWarn);IDE0060 - - + + diff --git a/src/Lucene.Net.Replicator/IndexRevision.cs b/src/Lucene.Net.Replicator/IndexRevision.cs index 69ba7b48cb..83f8d725cc 100644 --- a/src/Lucene.Net.Replicator/IndexRevision.cs +++ b/src/Lucene.Net.Replicator/IndexRevision.cs @@ -2,6 +2,7 @@ using Lucene.Net.Diagnostics; using Lucene.Net.Index; using Lucene.Net.Store; +using Lucene.Net.Support; using System; using System.Collections.Generic; using System.Globalization; @@ -79,14 +80,14 @@ public static IDictionary> RevisionFiles(IndexCommit } revisionFiles.Add(CreateRevisionFile(segmentsFile, dir)); // segments_N must be last - return new Dictionary> + return Collections.AsReadOnly(new Dictionary> { { SOURCE, revisionFiles } - }.AsReadOnly(); + }); } - + /// - /// Returns a string representation of a revision's version from the given + /// Returns a string representation of a revision's version from the given /// /// public static string RevisionVersion(IndexCommit commit) @@ -149,4 +150,4 @@ public override string ToString() return "IndexRevision version=" + Version + " files=" + SourceFiles; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj index 9d721ac034..585813dcf0 100644 --- a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj +++ b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj @@ -30,7 +30,7 @@ - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Replicator $(PackageTags);files;replication;replicate diff --git a/src/Lucene.Net.Replicator/ReplicationClient.cs b/src/Lucene.Net.Replicator/ReplicationClient.cs index e002b3a6fd..ae735c576a 100644 --- a/src/Lucene.Net.Replicator/ReplicationClient.cs +++ b/src/Lucene.Net.Replicator/ReplicationClient.cs @@ -1,8 +1,8 @@ using J2N; -using J2N.Collections.Generic.Extensions; using J2N.Threading; using Lucene.Net.Diagnostics; using Lucene.Net.Store; +using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; using System; @@ -56,7 +56,7 @@ private class ReplicationThread : ThreadJob internal readonly CountdownEvent stop = new CountdownEvent(1); /// - /// + /// /// /// The interval in milliseconds. /// The thread name. @@ -206,7 +206,7 @@ private void DoUpdate() output = directory.CreateOutput(file.FileName, IOContext.DEFAULT); CopyBytes(output, input); - + cpFiles.Add(file.FileName); // TODO add some validation, on size / checksum } @@ -230,7 +230,7 @@ private void DoUpdate() finally { if (!notify) - { + { // cleanup after ourselves IOUtils.Dispose(sourceDirectory.Values); factory.CleanupSession(session.Id); @@ -247,7 +247,7 @@ private void DoUpdate() if (notify && !disposed) { // no use to notify if we are closed already // LUCENENET specific - pass the copiedFiles as read only - handler.RevisionReady(session.Version, session.SourceFiles, copiedFiles.AsReadOnly(), sourceDirectory); + handler.RevisionReady(session.Version, session.SourceFiles, Collections.AsReadOnly(copiedFiles), sourceDirectory); } } finally @@ -451,7 +451,7 @@ public override string ToString() /// is running or not. /// /// - public virtual void UpdateNow() + public virtual void UpdateNow() { EnsureOpen(); @@ -467,8 +467,8 @@ public virtual void UpdateNow() } } - /// - /// Gets or sets the to use for logging messages. + /// + /// Gets or sets the to use for logging messages. /// public virtual InfoStream InfoStream { @@ -519,9 +519,9 @@ public interface ISourceDirectoryFactory Directory GetDirectory(string sessionId, string source); //throws IOException; /// - /// Called to denote that the replication actions for this session were finished and the directory is no longer needed. + /// Called to denote that the replication actions for this session were finished and the directory is no longer needed. /// /// void CleanupSession(string sessionId); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj b/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj index 2dcb6620eb..3dd75428c7 100644 --- a/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj +++ b/src/Lucene.Net.Sandbox/Lucene.Net.Sandbox.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Sandbox $(PackageTags);sandbox @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj index 616b22b98d..d65a374244 100644 --- a/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj +++ b/src/Lucene.Net.Spatial/Lucene.Net.Spatial.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Spatial $(PackageTags);spatial;geo;geospatial;2d @@ -39,7 +39,7 @@ enable - + @@ -47,7 +47,7 @@ - + diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs index b60118bf81..5d95a05475 100644 --- a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs +++ b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs @@ -1,5 +1,5 @@ -using J2N.Collections.Generic.Extensions; -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; +using Lucene.Net.Support; using Spatial4n.Context; using Spatial4n.Shapes; using System; @@ -191,7 +191,7 @@ protected internal virtual Cell GetCell(IPoint p, int level) /// ~20-25% fewer cells. /// /// a set of cells (no dups), sorted, immutable, non-null - public virtual IList GetCells(IShape? shape, int detailLevel, bool inclParents, + public virtual IList GetCells(IShape? shape, int detailLevel, bool inclParents, bool simplify) { //TODO consider an on-demand iterator -- it won't build up all cells in memory. @@ -214,8 +214,8 @@ public virtual IList GetCells(IShape? shape, int detailLevel, bool inclPar /// descends. /// /// is null. - private bool RecursiveGetCells(Cell cell, IShape? shape, int detailLevel, - bool inclParents, bool simplify, + private bool RecursiveGetCells(Cell cell, IShape? shape, int detailLevel, + bool inclParents, bool simplify, IList result) { // LUCENENET specific - added guard clause @@ -286,7 +286,7 @@ public virtual IList GetCells(IPoint p, int detailLevel, bool inclParents) Cell cell = GetCell(p, detailLevel); if (!inclParents) { - return new[] { cell }.AsReadOnly(); + return Collections.AsReadOnly(new[] { cell }); } string endToken = cell.TokenString; if (Debugging.AssertsEnabled) Debugging.Assert(endToken.Length == detailLevel); diff --git a/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj b/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj index f23c686671..4f16d4efe1 100644 --- a/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj +++ b/src/Lucene.Net.Suggest/Lucene.Net.Suggest.csproj @@ -28,9 +28,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Suggest $(PackageTags);suggest;suggestion @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj index 712ec3b0e2..2a94042190 100644 --- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj +++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj @@ -30,20 +30,20 @@ - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.TestFramework Lucene.Net $(PackageTags);testframework;test;framework;nunit bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - + + $(NoWarn);1591;1573 $(NoWarn);IDE0028 - - + + @@ -71,12 +71,12 @@ - + - + @@ -84,7 +84,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -116,4 +116,4 @@ - \ No newline at end of file + diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoReader.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoReader.cs index cc86c6acf3..0b344b2228 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoReader.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xSegmentInfoReader.cs @@ -1,13 +1,12 @@ -using J2N.Collections.Generic.Extensions; using Lucene.Net.Diagnostics; +using Lucene.Net.Support; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; +using System.Runtime.CompilerServices; using JCG = J2N.Collections.Generic; using CompoundFileDirectory = Lucene.Net.Store.CompoundFileDirectory; using Directory = Lucene.Net.Store.Directory; -using System.Runtime.CompilerServices; namespace Lucene.Net.Codecs.Lucene3x { @@ -41,7 +40,7 @@ namespace Lucene.Net.Codecs.Lucene3x /// /// Lucene 3x implementation of . /// - /// @lucene.experimental + /// @lucene.experimental /// [Obsolete("Only for reading existing 3.x indexes")] public class Lucene3xSegmentInfoReader : SegmentInfoReader @@ -292,7 +291,7 @@ private SegmentCommitInfo ReadLegacySegmentInfo(Directory dir, int format, Index } } - SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile, null, diagnostics, attributes.AsReadOnly()); + SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile, null, diagnostics, Collections.AsReadOnly(attributes)); info.SetFiles(files); SegmentCommitInfo infoPerCommit = new SegmentCommitInfo(info, delCount, delGen, -1); @@ -314,9 +313,9 @@ private SegmentInfo ReadUpgradedSegmentInfo(string name, Directory dir, IndexInp ISet files = input.ReadStringSet(); - SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile, null, diagnostics, attributes.AsReadOnly()); + SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile, null, diagnostics, Collections.AsReadOnly(attributes)); info.SetFiles(files); return info; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosReader.cs b/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosReader.cs index 5c53f0072f..f3c448bdd3 100644 --- a/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosReader.cs +++ b/src/Lucene.Net/Codecs/Lucene42/Lucene42FieldInfosReader.cs @@ -1,5 +1,5 @@ -using J2N.Collections.Generic.Extensions; -using J2N.Numerics; +using J2N.Numerics; +using Lucene.Net.Support; using System; using System.Collections.Generic; @@ -56,8 +56,8 @@ public override FieldInfos Read(Directory directory, string segmentName, string bool success = false; try { - CodecUtil.CheckHeader(input, Lucene42FieldInfosFormat.CODEC_NAME, - Lucene42FieldInfosFormat.FORMAT_START, + CodecUtil.CheckHeader(input, Lucene42FieldInfosFormat.CODEC_NAME, + Lucene42FieldInfosFormat.FORMAT_START, Lucene42FieldInfosFormat.FORMAT_CURRENT); int size = input.ReadVInt32(); //read in the size @@ -99,8 +99,8 @@ public override FieldInfos Read(Directory directory, string segmentName, string DocValuesType docValuesType = GetDocValuesType(input, (byte)(val & 0x0F)); DocValuesType normsType = GetDocValuesType(input, (byte)((val.TripleShift(4)) & 0x0F)); IDictionary attributes = input.ReadStringStringMap(); - infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, - omitNorms, storePayloads, indexOptions, docValuesType, normsType, attributes.AsReadOnly()); + infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, + omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.AsReadOnly(attributes)); } CodecUtil.CheckEOF(input); @@ -149,4 +149,4 @@ private static DocValuesType GetDocValuesType(IndexInput input, byte b) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosReader.cs b/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosReader.cs index 0c41a05eba..83b9cd7b95 100644 --- a/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosReader.cs +++ b/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosReader.cs @@ -1,5 +1,5 @@ -using J2N.Collections.Generic.Extensions; -using J2N.Numerics; +using J2N.Numerics; +using Lucene.Net.Support; using System.Collections.Generic; namespace Lucene.Net.Codecs.Lucene46 @@ -36,7 +36,7 @@ namespace Lucene.Net.Codecs.Lucene46 /// /// Lucene 4.6 FieldInfos reader. /// - /// @lucene.experimental + /// @lucene.experimental /// /// internal sealed class Lucene46FieldInfosReader : FieldInfosReader @@ -97,7 +97,7 @@ public override FieldInfos Read(Directory directory, string segmentName, string DocValuesType normsType = GetDocValuesType(input, (byte)((val.TripleShift(4)) & 0x0F)); long dvGen = input.ReadInt64(); IDictionary attributes = input.ReadStringStringMap(); - infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, normsType, attributes.AsReadOnly()); + infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.AsReadOnly(attributes)); infos[i].DocValuesGen = dvGen; } @@ -156,4 +156,4 @@ private static DocValuesType GetDocValuesType(IndexInput input, byte b) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/BaseCompositeReader.cs b/src/Lucene.Net/Index/BaseCompositeReader.cs index 3bcdb1ca68..c9bb921749 100644 --- a/src/Lucene.Net/Index/BaseCompositeReader.cs +++ b/src/Lucene.Net/Index/BaseCompositeReader.cs @@ -1,4 +1,4 @@ -using J2N.Collections.Generic.Extensions; +using Lucene.Net.Support; using System; using System.Collections.Generic; @@ -36,7 +36,7 @@ namespace Lucene.Net.Index /// as documents are added to and deleted from an index. Clients should thus not /// rely on a given document having the same number between sessions. /// - /// NOTE: + /// NOTE: /// instances are completely thread /// safe, meaning multiple threads can call any of its methods, /// concurrently. If your application requires external @@ -71,7 +71,7 @@ public abstract class BaseCompositeReader : CompositeReader protected BaseCompositeReader(R[] subReaders) { this.subReaders = subReaders; - this.subReadersList = ((IndexReader[])subReaders).AsReadOnly(); // LUCENENET: Work around generic casting from R to IndexWriter + this.subReadersList = Collections.AsReadOnly((IndexReader[])subReaders); // LUCENENET: Work around generic casting from R to IndexWriter starts = new int[subReaders.Length + 1]; // build starts array int maxDoc = 0, numDocs = 0; for (int i = 0; i < subReaders.Length; i++) @@ -215,4 +215,4 @@ protected internal override sealed IList GetSequentialSubReaders() return subReadersList; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/CompositeReaderContext.cs b/src/Lucene.Net/Index/CompositeReaderContext.cs index 205a6be28a..59f9ea72b1 100644 --- a/src/Lucene.Net/Index/CompositeReaderContext.cs +++ b/src/Lucene.Net/Index/CompositeReaderContext.cs @@ -1,5 +1,5 @@ -using J2N.Collections.Generic.Extensions; -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; +using Lucene.Net.Support; using System.Collections.Generic; using JCG = J2N.Collections.Generic; @@ -56,7 +56,7 @@ internal CompositeReaderContext(CompositeReader reader, IList children, IList leaves) : base(parent, ordInParent, docbaseInParent) { - this.children = children.AsReadOnly(); + this.children = Collections.AsReadOnly(children); this.leaves = leaves; this.reader = reader; } @@ -130,4 +130,4 @@ internal IndexReaderContext Build(CompositeReaderContext parent, IndexReader rea } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/MergePolicy.cs b/src/Lucene.Net/Index/MergePolicy.cs index 577abba5f5..5423ba3190 100644 --- a/src/Lucene.Net/Index/MergePolicy.cs +++ b/src/Lucene.Net/Index/MergePolicy.cs @@ -1,5 +1,5 @@ -using J2N.Collections.Generic.Extensions; -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; +using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; using System; @@ -56,7 +56,7 @@ namespace Lucene.Net.Index /// then return the necessary merges. /// /// Note that the policy can return more than one merge at - /// a time. In this case, if the writer is using + /// a time. In this case, if the writer is using /// , the merges will be run /// sequentially but if it is using /// they will be run concurrently. @@ -190,7 +190,7 @@ public virtual IList GetMergeReaders() readers.Add(reader); } } - return readers.AsReadOnly(); + return Collections.AsReadOnly(readers); } /// @@ -450,7 +450,7 @@ public class MergeSpecification public IList Merges { get; private set; } /// - /// Sole constructor. Use + /// Sole constructor. Use /// to add merges. /// public MergeSpecification() @@ -488,7 +488,7 @@ public virtual string SegString(Directory dir) /// Exception thrown if there are any problems while /// executing a merge. /// - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE_EXCEPTIONS [Serializable] @@ -544,7 +544,7 @@ protected MergeException(SerializationInfo info, StreamingContext context) /// false. Normally this exception is /// privately caught and suppresed by . /// - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE_EXCEPTIONS [Serializable] @@ -736,7 +736,7 @@ public virtual bool UseCompoundFile(SegmentInfos infos, SegmentCommitInfo merged } /// - /// Return the byte size of the provided + /// Return the byte size of the provided /// , pro-rated by percentage of /// non-deleted documents is set. /// @@ -763,7 +763,7 @@ protected bool IsMerged(SegmentInfos infos, SegmentCommitInfo info) #pragma warning disable 612, 618 && !info.Info.HasSeparateNorms #pragma warning restore 612, 618 - && info.Info.Dir == w.Directory + && info.Info.Dir == w.Directory && UseCompoundFile(infos, info) == info.Info.UseCompoundFile; } @@ -812,4 +812,4 @@ public double MaxCFSSegmentSizeMB } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/SegmentCommitInfo.cs b/src/Lucene.Net/Index/SegmentCommitInfo.cs index e8a5fec42d..5ebf8ae023 100644 --- a/src/Lucene.Net/Index/SegmentCommitInfo.cs +++ b/src/Lucene.Net/Index/SegmentCommitInfo.cs @@ -99,7 +99,7 @@ public SegmentCommitInfo(SegmentInfo info, int delCount, long delGen, long field /// /// Returns the per generation updates files. - public virtual IDictionary> UpdatesFiles => genUpdatesFiles.AsReadOnly(); + public virtual IDictionary> UpdatesFiles => Collections.AsReadOnly(genUpdatesFiles); /// /// Sets the updates file names per generation. Does not deep clone the map. @@ -289,4 +289,4 @@ public virtual object Clone() return other; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj index b04cb5b042..c4c163d392 100644 --- a/src/Lucene.Net/Lucene.Net.csproj +++ b/src/Lucene.Net/Lucene.Net.csproj @@ -22,9 +22,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net Lucene.Net is a full-text search engine library capable of advanced text analysis, indexing, and searching. It can be used to easily add search capabilities to applications. Lucene.Net is a C# port of the popular Java Lucene search engine framework from The Apache Software Foundation, targeted at .NET Framework and .NET Core users. @@ -36,7 +36,7 @@ true - + $(SolutionDir)src\dotnet\ @@ -100,7 +100,7 @@ - + diff --git a/src/Lucene.Net/Store/NativeFSLockFactory.cs b/src/Lucene.Net/Store/NativeFSLockFactory.cs index 5935a3ecf7..a38d866174 100644 --- a/src/Lucene.Net/Store/NativeFSLockFactory.cs +++ b/src/Lucene.Net/Store/NativeFSLockFactory.cs @@ -1,9 +1,9 @@ using Lucene.Net.Support.IO; +using Lucene.Net.Support.Threading; using Lucene.Net.Util; using System; -using System.IO; using System.Collections.Generic; -using Lucene.Net.Support.Threading; +using System.IO; namespace Lucene.Net.Store { @@ -625,7 +625,7 @@ public override string ToString() } // Uses FileStream locking of file pages. -#if NET6_0 +#if FEATURE_SUPPORTEDOSPLATFORMATTRIBUTE [System.Runtime.Versioning.SupportedOSPlatform("windows")] #endif internal class NativeFSLock : Lock @@ -832,4 +832,4 @@ public static void Lock(this FileStream stream, long position, long length) } } #endif -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Support/Collections.cs b/src/Lucene.Net/Support/Collections.cs index b7bb6ef4d9..87d33daa7a 100644 --- a/src/Lucene.Net/Support/Collections.cs +++ b/src/Lucene.Net/Support/Collections.cs @@ -88,7 +88,7 @@ public static IComparer ReverseOrder(IComparer cmp) public static IDictionary SingletonMap(TKey key, TValue value) { - return new Dictionary { { key, value } }.AsReadOnly(); + return AsReadOnly(new Dictionary { { key, value } }); } @@ -213,6 +213,16 @@ public static string ToString(object obj, CultureInfo culture) return ToString(obj); } + public static ReadOnlyList AsReadOnly(IList list) + { + return new ReadOnlyList(list); + } + + public static ReadOnlyDictionary AsReadOnly(IDictionary dictionary) + { + return new ReadOnlyDictionary(dictionary); + } + #region Nested Types #region ReverseComparer diff --git a/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj b/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj index 827d421e01..c805100438 100644 --- a/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj +++ b/src/dotnet/Lucene.Net.ICU/Lucene.Net.ICU.csproj @@ -30,7 +30,7 @@ - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.ICU $(PackageTags);icu;international;unicode @@ -39,7 +39,7 @@ $(DefineConstants);FEATURE_BREAKITERATOR - + diff --git a/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj b/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj index e415034aaa..a40185d2ce 100644 --- a/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj +++ b/src/dotnet/Lucene.Net.Replicator.AspNetCore/Lucene.Net.Replicator.AspNetCore.csproj @@ -23,9 +23,9 @@ - + - net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;net6.0;netstandard2.1;netstandard2.0;net462 Lucene.Net.Replicator.AspNetCore AspNetCore integration of Lucene.Net.Replicator for the Lucene.Net full-text search engine library from The Apache Software Foundation. @@ -34,12 +34,12 @@ $(NoWarn);1591;1573 - + - +