You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by la...@apache.org on 2023/04/08 04:30:54 UTC

[lucenenet] branch master updated: BREAKING: remove virtual call from the constructor (#807)

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 ba8065303 BREAKING: remove virtual call from the constructor (#807)
ba8065303 is described below

commit ba8065303b999ebf86844bb87379054a3c4ef361
Author: Laimonas Simutis <la...@gmail.com>
AuthorDate: Fri Apr 7 21:30:48 2023 -0700

    BREAKING: remove virtual call from the constructor (#807)
---
 src/Lucene.Net/Search/DisjunctionMaxQuery.cs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/Lucene.Net/Search/DisjunctionMaxQuery.cs b/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
index 8ad478d27..be7aeafd6 100644
--- a/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
+++ b/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
@@ -86,7 +86,7 @@ namespace Lucene.Net.Search
         public DisjunctionMaxQuery(ICollection<Query> disjuncts, float tieBreakerMultiplier)
         {
             this.tieBreakerMultiplier = tieBreakerMultiplier;
-            Add(disjuncts);
+            AddInternal(disjuncts); // LUCENENET specific - calling private instead of virtual
         }
 
         /// <summary>
@@ -101,10 +101,13 @@ namespace Lucene.Net.Search
         /// Add a collection of disjuncts to this disjunction
         /// via <see cref="T:IEnumerable{Query}"/> </summary>
         /// <param name="disjuncts"> A collection of queries to add as disjuncts. </param>
-        public virtual void Add(ICollection<Query> disjuncts)
-        {
+        public virtual void Add(ICollection<Query> disjuncts) =>
+            AddInternal(disjuncts);
+
+        // LUCENENET specific - S1699 - introduced private AddInternal that
+        // is called from virtual Add and constructor
+        private void AddInternal(ICollection<Query> disjuncts) =>
             this.disjuncts.AddRange(disjuncts);
-        }
 
         /// <returns> An <see cref="T:IEnumerator{Query}"/> over the disjuncts </returns>
         public virtual IEnumerator<Query> GetEnumerator()