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 7b175ee78 BREAKING: Fix/virtual calls from constructors for AbstractBlockPackedWriter (#815) 7b175ee78 is described below commit 7b175ee785d7fd5fdb936aae9abde058faffb682 Author: Laimonas Simutis <lai...@gmail.com> AuthorDate: Mon Apr 10 12:41:06 2023 -0700 BREAKING: Fix/virtual calls from constructors for AbstractBlockPackedWriter (#815) * remove virtual call from the constructor --- src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs b/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs index e7af57159..3ad541d0b 100644 --- a/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs +++ b/src/Lucene.Net/Util/Packed/AbstractBlockPackedWriter.cs @@ -67,14 +67,23 @@ namespace Lucene.Net.Util.Packed 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) => ResetInternal(@out); + [MethodImpl(MethodImplOptions.AggressiveInlining)] - public virtual void Reset(DataOutput @out) + private void ResetInternal(DataOutput @out) { if (Debugging.AssertsEnabled) Debugging.Assert(@out != null); this.m_out = @out;