laimis opened a new pull request, #849:
URL: https://github.com/apache/lucenenet/pull/849

   Continuation of fixes with virtual calls being made from constructors. The 
issue originally reported by SonarCloud scans: 
https://sonarcloud.io/project/issues?resolved=false&rules=csharpsquid%3AS1699&id=apache_lucenenet
 and referenced in this issue: https://github.com/apache/lucenenet/issues/670
   
   This takes care of what should be the last issue in this area. We already 
modified DirectoryTaxonomyWriter to accept a factory for index writer and now 
the last remaining virtual call it makes is to AddCategory in case an empty/new 
taxonomy directory is being created.
   
   There does not appear to be an easy way to translate this into a factory 
that makes a logical sense.
   
   I considered adding a private AddCategory method that constructor and 
AddCategory could call, but it seemed like it would prevent the subclasses to 
completely intercept and modify the root category AddCategory call. Instead, 
went with the comments to warn the users about what is happening. I think a 
subclass has an option to do something like capture an attempt to add root 
category (easy to detect if it is root by ID), and save it to be written later 
(e.g. post constructor run from its own constructor).


-- 
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: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to