One problem with Java is that the access control mechanisms are very coarse. 
Let's look at ProducedInternal. The reason it exists is to expose the 
`keySerde()`, `valueSerde()`, and `streamPartitioner()` getters. The Produced 
class intentionally doesn't expose the getters.

Regardless of whether Produced is immutable, if we add these getters to 
`Produced`, they would become part of the public API (which needs a KIP, etc).

It doesn't really matter whether `ProducedInternal` has a public constructor or 
not, since it's still in the `internal` package, which documents that it's "not 
a public interface".

It's better, of course, if we can avoid making the constructor public, since 
then the compiler backs up our package-based "this is not public" statement.

If this were scala, we could add `private[streams]` modifiers to these methods 
and just put them in Produced, but there's no way to do this in Java... c'est 
la vie.

[ Full content available at: https://github.com/apache/kafka/pull/5551 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to