This is an automated email from the ASF dual-hosted git repository.

laimis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new 34e9f45e7 BREAKING: AbstractAnalysisFactory.Get non-virtual to avoid 
issues in constructors (#800)
34e9f45e7 is described below

commit 34e9f45e77d07892440349c3e707cf7b16b4d435
Author: Laimonas Simutis <[email protected]>
AuthorDate: Thu Apr 6 11:35:57 2023 -0700

    BREAKING: AbstractAnalysisFactory.Get non-virtual to avoid issues in 
constructors (#800)
---
 .../Analysis/Util/AbstractAnalysisFactory.cs             | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs 
b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
index 0f2b41ba9..5afe7c5c5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
@@ -129,24 +129,32 @@ namespace Lucene.Net.Analysis.Util
             throw new ArgumentException($"Configuration Error: '{name}' value 
must be one of {Collections.ToString(allowedValues)}");
         }
 
-        public virtual string Get(IDictionary<string, string> args, string 
name, string defaultVal = null)
+        // LUCENENET specific - S1699 - marked non-virtual because calling
+        // virtual members from the constructor is not a safe operation in .NET
+        public string Get(IDictionary<string, string> args, string name, 
string defaultVal = null)
         {
             if (args.TryGetValue(name, out string s))
                 args.Remove(name);
             return s ?? defaultVal;
         }
 
-        public virtual string Get(IDictionary<string, string> args, string 
name, ICollection<string> allowedValues)
+        // LUCENENET specific - S1699 - marked non-virtual because calling
+        // virtual members from the constructor is not a safe operation in .NET
+        public string Get(IDictionary<string, string> args, string name, 
ICollection<string> allowedValues)
         {
             return Get(args, name, allowedValues, defaultVal: null);
         }
 
-        public virtual string Get(IDictionary<string, string> args, string 
name, ICollection<string> allowedValues, string defaultVal)
+        // LUCENENET specific - S1699 - marked non-virtual because calling
+        // virtual members from the constructor is not a safe operation in .NET
+        public string Get(IDictionary<string, string> args, string name, 
ICollection<string> allowedValues, string defaultVal)
         {
             return Get(args, name, allowedValues, defaultVal, caseSensitive: 
true);
         }
 
-        public virtual string Get(IDictionary<string, string> args, string 
name, ICollection<string> allowedValues, string defaultVal, bool caseSensitive)
+        // LUCENENET specific - S1699 - marked non-virtual because calling
+        // virtual members from the constructor is not a safe operation in .NET
+        public string Get(IDictionary<string, string> args, string name, 
ICollection<string> allowedValues, string defaultVal, bool caseSensitive)
         {
             if (!args.TryGetValue(name, out string s) || s is null)
             {

Reply via email to