Wazi Armstrong
Wazi Armstrong

Reputation: 31

Abstract method in non-abstract class?

I'm slightly confused here. While I was reading the API Documentation of some Android's classes, I found out that SpannableStringBuilder class contains an abstract method

abstract void drawText(Canvas c, int start, int end, float x, float y, Paint p)

while SpannableStringBuilder is a non-abstract class.

As I know , a non-abstract class can not contain an abstract method, and can not be instantiated. (SpannableStringBuilder can be instantiated as well) So what's the problem here?

Upvotes: 1

Views: 495

Answers (1)

usr-local-ΕΨΗΕΛΩΝ
usr-local-ΕΨΗΕΛΩΝ

Reputation: 26904

All of what you said is true.

That is a documentation bug. The method is not abstract.

Source code

 /**
 * Don't call this yourself -- exists for Canvas to use internally.
 * {@hide}
 */
public void drawText(Canvas c, int start, int end,
                     float x, float y, Paint p) {
    checkRange("drawText", start, end);

    if (end <= mGapStart) {
[...]

Upvotes: 1

Related Questions