NightOwl888 commented on code in PR #831:
URL: https://github.com/apache/lucenenet/pull/831#discussion_r1165946293


##########
src/Lucene.Net.QueryParser/Surround/Query/ComposedQuery.cs:
##########
@@ -28,13 +27,22 @@ namespace Lucene.Net.QueryParsers.Surround.Query
     /// </summary>
     public abstract class ComposedQuery : SrndQuery
     {
-        protected ComposedQuery(IList<SrndQuery> qs, bool operatorInfix, 
string opName) // LUCENENET: CA1012: Abstract types should not have 
constructors (marked protected)
+        // LUCENENET specific - provided protected parameterless constructor 
to allow subclasses
+        // avoid issues with virtual Recompose method
+        protected ComposedQuery(bool operatorInfix, string opName)
         {
-            Recompose(qs);
             this.operatorInfix = operatorInfix;
             this.m_opName = opName;
         }
 
+        [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")]
+        protected ComposedQuery(IList<SrndQuery> qs, bool operatorInfix, 
string opName) // LUCENENET: CA1012: Abstract types should not have 
constructors (marked protected)
+            : this(operatorInfix, opName)
+        {
+            Recompose(qs);
+        }
+
         protected virtual void Recompose(IList<SrndQuery> queries)

Review Comment:
   Yeah, I don't see much of a downside to having that state available inside 
of the method as opposed to not having it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to