From 47adc07d0e21cdc8f7548c9517b12d69e5521054 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Tue, 31 Dec 2024 17:28:22 -0700 Subject: [PATCH] Simplify IndexReader constructor, #919 (#1081) --- src/Lucene.Net/Index/IndexReader.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Lucene.Net/Index/IndexReader.cs b/src/Lucene.Net/Index/IndexReader.cs index 518cbde041..429a124582 100644 --- a/src/Lucene.Net/Index/IndexReader.cs +++ b/src/Lucene.Net/Index/IndexReader.cs @@ -85,10 +85,11 @@ public abstract partial class IndexReader : IDisposable private protected IndexReader() // LUCENENET: Changed from internal to private protected { - if (!(this is CompositeReader || this is AtomicReader)) - { - throw Error.Create("IndexReader should never be directly extended, subclass AtomicReader or CompositeReader instead."); - } + // LUCENENET NOTE: this is enforced by the compiler in .NET due to `private protected`, so we don't need to check it here. + // if (!(this is CompositeReader || this is AtomicReader)) + // { + // throw Error.Create("IndexReader should never be directly extended, subclass AtomicReader or CompositeReader instead."); + // } } #if !FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR