You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/01/08 16:44:45 UTC

[GitHub] [commons-io] garydgregory commented on pull request #66: Avoid Code Duplication: Reuse Sleep from ThreadMonitor

garydgregory commented on pull request #66:
URL: https://github.com/apache/commons-io/pull/66#issuecomment-756862696


   > Hi @DaGeRe !
   > 
   > Agree that code duplication is bad. But the change could perhaps be changed a little bit to make it easier to accept it in my opinion.
   > 
   > In `ThreadMonitor`, when you make it public, it also means that we are telling users that they are free to use this class in their code as well. Instead of it being hidden in the package level (which doesn't necessarily stops them, but discourages and at least raises the question of whether they should use it).
   > 
   > But I agree with the remaining changes (except by one incorrect indentation that may raise a checkstyle issue).
   > 
   > Would you like to try, perhaps, creating a test class in the same package, but under the test sources? That way you can either wrap or extend the origin `ThreadMonitor` and still remove the duplication in the `sleep` method. Also making it easier for us to maintain the code :-)
   > 
   > Cheers
   > Bruno
   
   Right, this class should stay package private.
   You can either subclass it in the test tree as a public class or provide a public test method that accesses the package private one.
   


----------------------------------------------------------------
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.

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