UladzislauBlok commented on PR #21304: URL: https://github.com/apache/kafka/pull/21304#issuecomment-3874267874
@mjsax Hello I also was thinking about this case, and I believe solution proposed by me is not ideal, but from my perspective that's about trade-off. Is it possible that someone will implement its own fixed key record and send to the topology? Yes, but they will need to make some effort to do that and it's definitely not common case in the sense that they are doing that **on purpose**. User can't just create instance of interface by mistake, user will need to implement it, so it's not safe but it's one more layer of protection In case of current implementation user can't extend the fixed key record, but they have direct access to factory with protection on documentation level. It's also not safe, but the problem is that users can use this factory **by mistake** and just not check the javadoc. Just to summarize my thoughts: both solutions not ideal, but the probability that users will abuse interface is less (from my perspective) than abuse of factory. TBH the best solution I think would be to use sealed interface, but they are coming with Java 17+ -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
