Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

However,  there is a risk that builders may inadvertently import / expose internal classes . For example, see KIP-1247: Make Bytes utils class part of the public API

This KIP proposes to introduce a mechanism that 

...

We propose to define a new interface which will be used to annotate public classes.

  • org.apache.kafka.common.annotation.PublicAPI 

Any class without this annotation will be considered internal.
Note that Apache Kafka already has annotations for denoting stability of an API , which will continue to be used for the same purpose. Eg:

...

We will use/implement a Gradle plugin similar to  https://github.com/revelc/apilyzer-maven-plugin to add these restrictions . Eg: https://code.revelc.net/apilyzer-maven-plugin/#annotation-example . This plugin implementation will also be checked into Apache Kafka code in the buildSrc  directory (as suggested by this thread).We will include restrictions within each individual modules of Apache Kafka which will ensure that the code only refers to public API from other modules. If there are exceptions, we will add exclusions and track the removal of reference to internal classes as

a separate Jira ticketThe docsJar step will fail if the Javadoc jar contains any un-annotated classes. Additionally, any class marked with @PublicApi must be included in the docsJar or an error will be reported.

Guardrails for Plugin developers

...