What is the advantage of "companion object" vs static keyword

… it would be interesting to see a specific, contextual example of where a static method does the job better than anything Kotlin can offer …

OK, how about something like this. Let’s say I want to be able to programmatically change the default color for a certain group of elements of a paint api. I need the default color for different types of elements to apply to all of the instances of a class of paint objects in the API.

file Shape.java:

package org.paintapi;

public abstract class Shape {
    static private long defaultColor;

    static public void setDefaultColor(long color) {
        defaultColor = color;
    }
}

file Text.java:

package org.paintapi;

final public class Text {
    static private long defaultColor;

    static public void setDefaultColor(long color) {
        defaultColor = color;
    }
}