Apache9 commented on a change in pull request #3248:
URL: https://github.com/apache/hbase/pull/3248#discussion_r629926805



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
##########
@@ -400,6 +387,12 @@ BalanceAction nextAction(BalancerClusterState cluster) {
       .generate(cluster);
   }
 
+  @RestrictedApi(explanation = "Should only be called in tests", link = "",

Review comment:
       Yes, @apurtell proposed to remove the VisibleForTesting annotation and 
the javadoc for VisibleForTestinng also tells that you should not use this 
annotation anymore and suggests you to use RestrictedApi.
   
   ```
   /**
    * Annotates a program element that exists, or is more widely visible than 
otherwise necessary, only
    * for use in test code.
    *
    * <p><b>Do not use this interface</b> for public or protected declarations: 
it is a fig leaf for
    * bad design, and it does not prevent anyone from using the 
declaration---and experience has shown
    * that they will. If the method breaks the encapsulation of its class, then 
its internal
    * representation will be hard to change. Instead, use <a
    * 
href="http://errorprone.info/bugpattern/RestrictedApiChecker";>RestrictedApiChecker</a>,
 which
    * enforces fine-grained visibility policies.
    *
    * @author Johannes Henkel
    */
   @GwtCompatible
   public @interface VisibleForTesting {
   }
   ```
   
   We will enable error prone when building the project in the general check 
state in pre commit, so if you break the restriction, there will be a compile 
error, which is much more useful than VisibleForTesting.




-- 
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:
[email protected]


Reply via email to