nfsantos commented on code in PR #1148:
URL: https://github.com/apache/jackrabbit-oak/pull/1148#discussion_r1357019222
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndex.java:
##########
@@ -465,6 +465,9 @@ public void remove() {
@Override
public IndexRow next() {
final IndexRow pathRow = pathCursor.next();
+ // we need to copy the reference to the current row here,
+ // otherwise all the returned IndexRows might reference the same
row
+ final FulltextResultRow currentRow = currentRowInPathIterator;
return new IndexRow() {
@Override
Review Comment:
To avoid unintentional capture of state from the parent class, you could
create a static subclass of IndexRow and declare an explicit constructor. This
requires the caller here to explicitly provide all the arguments that are
needed and to copy them into the new object of IndexRow, thus avoiding any
accidental use of mutable state from the parent class.
--
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]