laimis commented on code in PR #814: URL: https://github.com/apache/lucenenet/pull/814#discussion_r1161288545
########## src/Lucene.Net/Store/ByteArrayDataOutput.cs: ########## @@ -38,26 +39,51 @@ public class ByteArrayDataOutput : DataOutput public ByteArrayDataOutput(byte[] bytes) { - Reset(bytes); + // LUCENENET: Changed to call private method to avoid virtual method call in constructor + ResetInternal(bytes, 0, bytes.Length); } public ByteArrayDataOutput(byte[] bytes, int offset, int len) { - Reset(bytes, offset, len); + // LUCENENET: Changed to call private method to avoid virtual method call in constructor + ResetInternal(bytes, offset, len); } public ByteArrayDataOutput() { - Reset(BytesRef.EMPTY_BYTES); + // LUCENENET: Changed to call private method to avoid virtual method call in constructor + ResetInternal(BytesRef.EMPTY_BYTES, 0, BytesRef.EMPTY_BYTES.Length); } - public virtual void Reset(byte[] bytes) - { - Reset(bytes, 0, bytes.Length); - } + /// <summary> + /// + /// 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> + public virtual void Reset(byte[] bytes) => + ResetInternal(bytes, 0, bytes.Length); Review Comment: Went with bytes?.Length ?? 0 -- 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