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/13 19:25:02 UTC

[lucenenet] branch master updated: Adjust QueryTemplateManager to allow subclasses avoid calling virtual methods from the constructors (#829)

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 a51aa50dc Adjust QueryTemplateManager to allow subclasses avoid calling virtual methods from the constructors (#829)
a51aa50dc is described below

commit a51aa50dc2ad78734d791184898b932ce1e2925d
Author: Laimonas Simutis <la...@gmail.com>
AuthorDate: Thu Apr 13 12:24:54 2023 -0700

    Adjust QueryTemplateManager to allow subclasses avoid calling virtual methods from the constructors (#829)
---
 src/Lucene.Net.QueryParser/Xml/QueryTemplateManager.cs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Lucene.Net.QueryParser/Xml/QueryTemplateManager.cs b/src/Lucene.Net.QueryParser/Xml/QueryTemplateManager.cs
index 4cace0610..7e755cb85 100644
--- a/src/Lucene.Net.QueryParser/Xml/QueryTemplateManager.cs
+++ b/src/Lucene.Net.QueryParser/Xml/QueryTemplateManager.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Xml;
 using System.Xml.Xsl;
@@ -40,6 +41,12 @@ namespace Lucene.Net.QueryParsers.Xml
         {
         }
 
+        /// <summary>
+        /// This class makes a virtual AddDefaultQueryTemplate call. If you need to subclass it
+        /// and make this call at a time when it suits you, use <see cref="QueryTemplateManager()" /> instead
+        /// </summary>
+        [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")]
         public QueryTemplateManager(Stream xslIs)
         {
             AddDefaultQueryTemplate(xslIs);