Fork us on GitHub

ToastBar Return Value

Build issue due to return type
ToastBar Return Value

ToastBar Return Value

Last week I pushed out an enhancement to ToastBar that changed the static showMessage methods. I made them return the Status object instead of void which would allow more control of the toast message after it’s shown. Unfortunately, I totally forgot that I can’t do that without breaking some binary compatibility.

In Java return types create a distinct method signature, so even though the language doesn’t allow you to do this:

void myMethod() {
}
int myMethod() {
    return 1;
}

This is actually valid in the bytecode level. Furthermore, it’s a used by the JVM to implement Java language features like covariant return types.

So if you used ToastBar and compiled against older libraries you might experience issues when building. Make sure to update your client libraries before sending a build by going into Codename One SettingsBasicUpdate Client Libs. Then do a clean/build before sending a new build.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.