mikepenz/Android-Iconics

IconicsTextView java.lang.IllegalArgumentException: Parameter specified as non-null is null

smelfungus opened this issue · 1 comments

About this issue

Hello! Seems like the standard TextView API:

public void setText(CharSequence text, BufferType type)

Which is calling:

private void setText(CharSequence text, BufferType type,
                         boolean notifyBefore, int oldlen)

is designed to accept and handle nullable text parameter:

if (text == null) {
    text = "";
}

However, Kotlin-based IconicsTextView requires text to be not null:

override fun setText(text: CharSequence, type: TextView.BufferType) {
    if (!isInEditMode) {
        super.setText(text.buildIconics(), type)
    } else {
        super.setText(text, type)
    }
}

That discrepancy causes issues when working with IconicsTextView in the same style as with a typical TextView.
How about making IconicsTextView to accept nullable text parameters explicitly?

Details

  • Used library version: 5.0.3

Just double checked. Ok they don't have an annotation for that one in place yet, so I believe we can change it.

There's a different issue which prevents us to update to compile 29 or higher (which I assumed first to be the same issue)