LUCENE-8503: Call #getDelegate instead of direct member access during unwrap

Filter*Reader instances access the member or the delegate directly instead of
calling getDelegate(). In order to track access of the delegate these methods
should call #getDelegat()
This commit is contained in:
Simon Willnauer 2018-09-17 10:39:41 +02:00
parent 36eae57163
commit 44dbfaab19
3 changed files with 4 additions and 4 deletions

View File

@ -48,8 +48,8 @@ public abstract class FilterCodecReader extends CodecReader {
} }
return reader; return reader;
} }
/** /**
* The underlying CodecReader instance. * The underlying CodecReader instance.
*/ */
protected final CodecReader in; protected final CodecReader in;

View File

@ -37,7 +37,7 @@ public abstract class FilterDirectoryReader extends DirectoryReader {
* an instance of {@link FilterDirectoryReader}. */ * an instance of {@link FilterDirectoryReader}. */
public static DirectoryReader unwrap(DirectoryReader reader) { public static DirectoryReader unwrap(DirectoryReader reader) {
while (reader instanceof FilterDirectoryReader) { while (reader instanceof FilterDirectoryReader) {
reader = ((FilterDirectoryReader) reader).in; reader = ((FilterDirectoryReader) reader).getDelegate();
} }
return reader; return reader;
} }

View File

@ -44,7 +44,7 @@ public abstract class FilterLeafReader extends LeafReader {
* an instance of {@link FilterLeafReader}. */ * an instance of {@link FilterLeafReader}. */
public static LeafReader unwrap(LeafReader reader) { public static LeafReader unwrap(LeafReader reader) {
while (reader instanceof FilterLeafReader) { while (reader instanceof FilterLeafReader) {
reader = ((FilterLeafReader) reader).in; reader = ((FilterLeafReader) reader).getDelegate();
} }
return reader; return reader;
} }