NightOwl888 commented on code in PR #819: URL: https://github.com/apache/lucenenet/pull/819#discussion_r1164384420
########## src/Lucene.Net/Codecs/BlockTreeTermsReader.cs: ########## @@ -114,10 +114,31 @@ public class BlockTreeTermsReader : FieldsProducer private readonly int version; + protected readonly TSubclassState m_subclassState; + /// <summary> /// Sole constructor. </summary> - public BlockTreeTermsReader(Directory dir, FieldInfos fieldInfos, SegmentInfo info, PostingsReaderBase postingsReader, IOContext ioContext, string segmentSuffix, int indexDivisor) + /// <param name="subclassState">LUCENENET specific parameter which allows a subclass + /// to set state. It is *optional* and can be used when overriding the ReadHeader(), + /// ReadIndexHeader() and SeekDir() methods. It only matters in the case where the state + /// is required inside of any of those methods that is passed in to the subclass constructor. + /// + /// When passed to the constructor, it is set to the protected field m_subclassState before + /// any of the above methods are called where it is available for reading when overriding the above methods. + /// + /// If your subclass needs to pass more than one piece of data, you can create a class or struct to do so. + /// All other virtual members of BlockTreeTermsReader are not called in the constructor, + /// so the overrides of those methods won't specifically need to use this field (although they could for consistency). + /// </param> + [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] + [SuppressMessage("CodeQuality", "S1699:Required for continuity with Lucene's design", Justification = "Internal class")] Review Comment: Oops, I meant to put that into the Justification property. ```c# [SuppressMessage("CodeQuality", "S1699:Constructors should only call non-overridable methods", Justification = "Required for continuity with Lucene's design")] ``` ########## src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs: ########## @@ -279,14 +286,33 @@ public FieldMetaData(FieldInfo fieldInfo, BytesRef rootCode, long numTerms, long private readonly IList<FieldMetaData> fields = new JCG.List<FieldMetaData>(); // private final String segment; + protected object m_subclassState = null; + /// <summary> /// Create a new writer. The number of items (terms or /// sub-blocks) per block will aim to be between - /// <paramref name="minItemsInBlock"/> and <paramref name="maxItemsInBlock"/>, though in some - /// cases the blocks may be smaller than the min. /// </summary> - public BlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) + /// <param name="subclassState">LUCENENET specific parameter which allows a subclass + /// to set state. It is *optional* and can be used when overriding the WriteHeader(), + /// WriteIndexHeader(). It only matters in the case where the state + /// is required inside of any of those methods that is passed in to the subclass constructor. + /// + /// When passed to the constructor, it is set to the protected field m_subclassState before + /// any of the above methods are called where it is available for reading when overriding the above methods. + /// + /// If your subclass needs to pass more than one piece of data, you can create a class or struct to do so. + /// All other virtual members of BlockTreeTermsWriter are not called in the constructor, + /// so the overrides of those methods won't specifically need to use this field (although they could for consistency). + /// </param> + [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] + [SuppressMessage("CodeQuality", "S1699:Required for continuity with Lucene's design", Justification = "Internal class")] Review Comment: Oops, I meant to put that into the Justification property. ```c# [SuppressMessage("CodeQuality", "S1699:Constructors should only call non-overridable methods", Justification = "Required for continuity with Lucene's design")] ``` -- 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