Hello,

In Java SDK, from time to time we face with an issue with an access to classes 
or methods, that are explicitly supposed to be as a part of public user’s API, 
but, by mistake, are made private or package-private.

For example this issue [1], where KinesisClientThrottledException is 
package-private but it can be an argument in a public method of RateLimitPolicy 
interface if user wishes to implement its own.

// public interface
public interface RateLimitPolicy {
  default void onThrottle(KinesisClientThrottledException e)
}

// package-private interface in the same package
class KinesisClientThrottledException {
  …
}

So user won’t be able to implement it’s own RateLimitPolicy with overridden 
onThrottle() method since KinesisClientThrottledException is package-private

Does anyone know a tool or something like compilation option or Spotless check, 
that can detect a broken API at compilation time in case if, for example, 
arguments of public method don’t have enough access privileges for that? It 
would be very helpful to prevent such errors.


[1] https://issues.apache.org/jira/browse/BEAM-10816

Reply via email to