Devs,

First off, this is a very forward looking discussion around something that will 
affect upcoming major releases when deprecating public APIs. One of the issues 
I am finding when investigating a few deprecated APIs for removal is that the 
deprecation hasn’t cascaded through to all the dependent APIs. In one specific 
cast, public API o.a.g.cache.query.IndexStatistics has int sized stats despite 
all int sized stats having been deprecated publicly for some time. Removing 
deprecated Statistics API results in a need to deprecate and add new methods to 
IndexStatistics. This is fine and easy enough to do now but it raises a 
question about API compatibility since adding methods to an interface is 
technically a compile time, or source, breaking change.

Adding a method to a public API interface results in a compile failure where 
3rd parties implement that interface. Java solved this by adding the default 
implementation concept. In this specific cast we could add default 
implementations to this IndexStatistics interface but I think there is an 
argument for not.

When a public API interfaces has no use case where 3rd parties would implement, 
such as return types or factory allocated implementations, there should not be 
a compile time breaking change. In the case of IndexStatistics there is no use 
case where a 3rd party could implement and provide their instance to Geode.

Do we want to just blanket add default method implementations to all public API 
interfaces changes or allow the exclusion of this changes when validating API 
changes?

This example can see in PR 7279:
https://github.com/apache/geode/pull/7279/files#diff-e9f3ff077afba249e36bd8eb30c3d6e2a80110c098a00e26711e2a2995751626R68

You will notice that the CI failed the API check with the following errors:
Error   Class org.apache.geode.cache.query.IndexStatistics: Is not source 
compatible
Error   Method 
org.apache.geode.cache.query.IndexStatistics.getNumberOfBucketIndexesLong(): Is 
not source compatible
                • Method added to interface
Error   Method 
org.apache.geode.cache.query.IndexStatistics.getReadLockCountLong(): Is not 
source compatible
                • Method added to interface

I would love your thoughts.

-Jake

Reply via email to