uschindler commented on code in PR #12296: URL: https://github.com/apache/lucene/pull/12296#discussion_r1195330910
########## lucene/core/src/java/org/apache/lucene/index/IndexReaderContext.java: ########## @@ -22,27 +22,26 @@ * A struct like class that represents a hierarchical relationship between {@link IndexReader} * instances. */ -public abstract class IndexReaderContext { +public abstract sealed class IndexReaderContext permits CompositeReaderContext, LeafReaderContext { /** The reader context for this reader's immediate parent, or null if none */ public final CompositeReaderContext parent; /** - * <code>true</code> if this context struct represents the top level reader within the - * hierarchical context + * {@code true} if this context struct represents the top level reader within the hierarchical + * context */ public final boolean isTopLevel; - /** the doc base for this reader in the parent, <code>0</code> if parent is null */ + /** the doc base for this reader in the parent, {@code 0} if parent is null */ public final int docBaseInParent; - /** the ord for this reader in the parent, <code>0</code> if parent is null */ + /** the ord for this reader in the parent, {@code 0} if parent is null */ public final int ordInParent; // An object that uniquely identifies this context without referencing // segments. The goal is to make it fine to have references to this // identity object, even after the index reader has been closed final Object identity = new Object(); - IndexReaderContext(CompositeReaderContext parent, int ordInParent, int docBaseInParent) { - if (!(this instanceof CompositeReaderContext || this instanceof LeafReaderContext)) - throw new Error("This class should never be extended by custom code!"); + protected IndexReaderContext( Review Comment: Please make it package protected again, as we don't want it to appear in Javadocs. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org