Avoid StackOverflowError when opening chat (kotlin2.0 fix)

When opening the chat the app crashed with

2024-06-18 10:59:45.039 30757-30757 AndroidRuntime          com.nextcloud.talk2                  E  FATAL EXCEPTION: main
  Process: com.nextcloud.talk2, PID: 30757
  java.lang.StackOverflowError: stack size 8192KB
  at com.nextcloud.talk.ui.MessageInput.getMessageSendButton(MessageInput.kt:75)

Hint in AS was:
Now field from base class com.stfalcon.chatkit.messages.MessageInput shadows the property with custom getter from derived class com.nextcloud.talk.ui.MessageInput. This behavior will be changed soon in favor of the property. Please use explicit cast to com.stfalcon.chatkit.messages.MessageInput if you wish to preserve current behavior. See https://youtrack.jetbrains.com/issue/KT-55017 for details

The issue is caused by the update to kotlin2.0.
Calling the super fields fixes the issue.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-06-18 11:54:33 +02:00
parent 1e14532713
commit 6ceafee3ed
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -60,19 +60,19 @@ class MessageInput : MessageInput {
}
var messageInput: EmojiEditText
get() = messageInput
get() = super.messageInput
set(messageInput) {
super.messageInput = messageInput
}
var attachmentButton: ImageButton
get() = attachmentButton
get() = super.attachmentButton
set(attachmentButton) {
super.attachmentButton = attachmentButton
}
var messageSendButton: ImageButton
get() = messageSendButton
get() = super.messageSendButton
set(messageSendButton) {
super.messageSendButton = messageSendButton
}