uschindler commented on code in PR #15864:
URL: https://github.com/apache/lucene/pull/15864#discussion_r2976129354
##########
lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java:
##########
@@ -71,60 +65,80 @@ private TestSecrets() {}
/** Return the accessor to internal secrets for an {@link IndexReader}. */
public static IndexPackageAccess getIndexPackageAccess() {
- ensureCaller();
+ ensureCallerForGetter();
+ if (indexWriterAccess == null) {
+ ensureInitialized.accept(IndexWriter.class);
+ }
return Objects.requireNonNull(indexPackageAccess);
}
/** Return the accessor to internal secrets for an {@link
ConcurrentMergeScheduler}. */
public static ConcurrentMergeSchedulerAccess
getConcurrentMergeSchedulerAccess() {
- ensureCaller();
+ ensureCallerForGetter();
+ if (cmsAccess == null) {
+ ensureInitialized.accept(ConcurrentMergeScheduler.class);
+ }
return Objects.requireNonNull(cmsAccess);
}
/** Return the accessor to internal secrets for an {@link SegmentReader}. */
public static SegmentReaderAccess getSegmentReaderAccess() {
- ensureCaller();
+ ensureCallerForGetter();
+ if (segmentReaderAccess == null) {
+ ensureInitialized.accept(SegmentReader.class);
+ }
return Objects.requireNonNull(segmentReaderAccess);
}
/** Return the accessor to internal secrets for an {@link IndexWriter}. */
public static IndexWriterAccess getIndexWriterAccess() {
- ensureCaller();
+ ensureCallerForGetter();
+ if (indexWriterAccess == null) {
+ ensureInitialized.accept(IndexWriter.class);
+ }
return Objects.requireNonNull(indexWriterAccess);
}
/** Return the accessor to internal secrets for an {@link FilterIndexInput}.
*/
public static FilterIndexInputAccess getFilterInputIndexAccess() {
- ensureCaller();
+ ensureCallerForGetter();
+ if (filterIndexInputAccess == null) {
+ ensureInitialized.accept(FilterIndexInput.class);
+ }
return Objects.requireNonNull(filterIndexInputAccess);
}
/** For internal initialization only. */
public static void setIndexWriterAccess(IndexWriterAccess indexWriterAccess)
{
+ ensureCallerForSetter(IndexWriter.class);
Review Comment:
That's nice that we check this now, but this change is unrelated, correct?
Anyways, good to have it!
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]