paulirwin commented on code in PR #1058:
URL: https://github.com/apache/lucenenet/pull/1058#discussion_r1997247501
##########
src/Lucene.Net/Analysis/TokenStream.cs:
##########
@@ -108,8 +130,17 @@ protected TokenStream(AttributeFactory factory)
{
// LUCENENET: Rather than using AssertFinal() to run Reflection
code at runtime,
// we are using a Roslyn code analyzer to ensure the rules are
followed at compile time.
+
+ // LUCENENET specific - track disposable TokenStreams that are
part of the current chain
+ disposableTracker = new DisposableTracker(This);
}
+ /// <summary>
+ /// LUCENENET: We cannot access <c>this</c> from the constructor, so
this property is used
+ /// to cheat the compiler.
+ /// </summary>
+ private TokenStream This => this;
Review Comment:
Are you sure this (no pun intended) is needed? I was curious when I saw it,
and tried it out and the compiler doesn't have an issue with using `this` from
the constructor. Or is there some non-compiler runtime failure doing that?
--
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]