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 21:25:29 UTC

[lucenenet] branch master updated: AttributesImpl add suppress and comment on using constructors (#834)

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 774d4b5b8 AttributesImpl add suppress and comment on using constructors (#834)
774d4b5b8 is described below

commit 774d4b5b85319fcdcd9f3f2bcbd2338745239f2f
Author: Laimonas Simutis <la...@gmail.com>
AuthorDate: Thu Apr 13 14:25:23 2023 -0700

    AttributesImpl add suppress and comment on using constructors (#834)
---
 src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
index 5943b36c7..84ad4ecbf 100644
--- a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
@@ -6,6 +6,7 @@
 
 using Lucene.Net.Support;
 using System;
+using System.Diagnostics.CodeAnalysis;
 
 namespace Sax.Helpers
 {
@@ -59,8 +60,14 @@ namespace Sax.Helpers
         /// <para/>
         /// This constructor is especially useful inside a
         /// <see cref="IContentHandler.StartElement(string, string, string, IAttributes)"/>.
+        ///
+        /// Note, this constructor calls a virtual <see cref="SetAttributes(IAttributes)"/> to copy the attributes.
+        /// If you are subclassing this class and don't want SetAttributes to be called, you should
+        /// use the <see cref="Attributes()"/> constructor instead and call <see cref="SetAttributes(IAttributes)"/> or <see cref="AddAttribute(string,string,string,string,string)"/> yourself if needed.
         /// </summary>
         /// <param name="atts">The existing <see cref="Attributes"/> object.</param>
+        [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")]
+        [SuppressMessage("CodeQuality", "S1699:Constructors should only call non-overridable methods", Justification = "There is an Attributes() constructor overload to work around the issue")]
         public Attributes(IAttributes atts)
         {
             SetAttributes(atts);