Skip to content

Cannot use Kotlin property syntax on ContainerProperties.idleEventInterval since release 2.7.3 #1900

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

Closed
psychobaatezu opened this issue Aug 5, 2021 · 2 comments

Comments

@psychobaatezu
Copy link
Contributor

psychobaatezu commented Aug 5, 2021

Since release 2.7.3, it's not possible anymore to use the Kotlin property syntax on ContainerProperties.idleEventInterval field.

image

This is caused by this commit : 0ee2d49

image

Granted, the field is actually nullable. But by adding the annotation on the getter instead of the actual field, it tells the Kotlin interpreter that the getter will return a nullable Long type (Long?) and the setter will apply the given value to a non-nullable Long Type (Long). This discrepancy blocks Kotlin property syntax because the underneath getter/setter are not for the same type.

So to use 2.7.3, existing code need to change to this to continue to work :

image

The solution to solve that is to put @Nullable annotation on the field instead, which by the way is more accurate.

psychobaatezu added a commit to psychobaatezu/spring-kafka that referenced this issue Aug 5, 2021
@psychobaatezu
Copy link
Contributor Author

Possible fix : #1901

psychobaatezu added a commit to psychobaatezu/spring-kafka that referenced this issue Aug 10, 2021
garyrussell pushed a commit to garyrussell/spring-kafka that referenced this issue Aug 10, 2021
@garyrussell garyrussell self-assigned this Aug 10, 2021
garyrussell pushed a commit that referenced this issue Aug 10, 2021
Add @nullable to setters for the corresponding nullable getters.
@garyrussell
Copy link
Contributor

Thanks; merged and cherry-picked to 2.7.x.

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

No branches or pull requests

2 participants