Skip to content

GH-2583 ProducerFactory.createProducer argument @Nullable #2584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

antonio-tomac
Copy link
Contributor

@antonio-tomac antonio-tomac commented Feb 15, 2023

Resolves: #2583

ProducerFactory.createProducer argument txIdPrefix is non-nullable which causes kotlin compiler to emit warning if implementations declare txIdPrefix as nullable txIdPrefix: String?

This PR changes signature of ProducerFactory.createProducer so that txIdPrefix is @Nullable and also adds unit test to verify compilation, and to verify that future versions of Kotlin won't cause compile errors.

Current users of kotlin who implemented ProducerFactory.createProducer(txIdPrefix) with txIdPrefix: String (non-nullable) will start seeing kotlin compiler warning that their signature is not matching base signature.



Resolves: 2583

ProducerFactory.createProducer argument txIdPrefix is non-nullable which causes kotlin compiler to emit warning if implementations declare txIdPrefix as nullable txIdPrefix: String?
@@ -56,7 +56,7 @@
* @return the producer.
* @since 2.3
*/
default Producer<K, V> createProducer(@SuppressWarnings("unused") String txIdPrefix) {
default Producer<K, V> createProducer(@Nullable @SuppressWarnings("unused") String txIdPrefix) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. It is a @Nullable in the DefaultKafkaProducerFactory.
So, the fix is correct.
Thank you!

@antonio-tomac
Copy link
Contributor Author

Did I had to amend my initial commit, or is it ok if requested changes are in second separate commit?

@artembilan
Copy link
Member

Right. New commit is fully OK.
We squash them on merge.
Thank you!

@artembilan artembilan merged commit 5e857bd into spring-projects:main Feb 15, 2023
@artembilan
Copy link
Member

Cherry-picked to 2.9.x as b17a045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProducerFactory's argument txIdPrefix of createProducer not marked as @Nullable
2 participants