NightOwl888 commented on code in PR #815:
URL: https://github.com/apache/lucenenet/pull/815#discussion_r1162017329
##########
src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs:
##########
@@ -67,14 +67,22 @@ internal static void WriteVInt64(DataOutput @out, long i)
protected AbstractBlockPackedWriter(DataOutput @out, int blockSize) //
LUCENENET specific - marked protected instead of public
{
PackedInt32s.CheckBlockSize(blockSize, MIN_BLOCK_SIZE,
MAX_BLOCK_SIZE);
- Reset(@out);
+ ResetInternal(@out); // LUCENENET specific - calling private
method instead of virtual Reset
m_values = new long[blockSize];
}
/// <summary>
- /// Reset this writer to wrap <paramref name="out"/>. The block size
remains unchanged. </summary>
+ /// Reset this writer to wrap <paramref name="out"/>. The block size
remains unchanged.
+ ///
+ /// NOTE: When overriding this method, be aware that the constructor
of this class calls
+ /// a private method and not this virtual method. So if you need to
override
+ /// the behavior during the initialization, call your own private
method from the constructor
+ /// with whatever custom behavior you need.
+ /// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public virtual void Reset(DataOutput @out)
+ public virtual void Reset(DataOutput @out) => ResetInternal(@out);
+
+ private void ResetInternal(DataOutput @out)
Review Comment:
Let's add `[MethodImpl(MethodImplOptions.AggressiveInlining)]` here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]