How do I access a Java static method on a Kotlin subclass?
<p>I've created a Kotlin subclass of a Java class:</p>

<pre><code>class AlarmReceiver : WakefulBroadcastReceiver() {

    companion object {
        const val ACTION_NOTIFY = "..."
    }

    override fun onReceive(context: Context, intent: Intent) { ... }
}
</code></pre>

<p><a href="https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html" rel="noreferrer"><code>WakefulBroadcastReceiver</code></a> has two static methods:</p>

<ul>
<li><code>static boolean completeWakefulIntent(Intent intent)</code></li>
<li><code>static ComponentName startWakefulService(Context context, Intent intent)</code></li>
</ul>

<p>and calling these from within my <code>AlarmReceiver</code> class works just as I expect. However, I'd like to call one of these methods <em>outside of my Kotlin subclass</em>.</p>

<h2>The Problem</h2>

<p>If I try <code>AlarmReceiver.completeWakefulIntent(intent)</code> from a different Kotlin class, I get the following compilation error:</p>

<blockquote>
  <p>Unresolved reference: completeWakefulIntent</p>
</blockquote>

<p>I think this is because the compiler is trying to resolve the method on <code>AlarmReceiver</code>'s companion object instead of finding the inherited method from its superclass. As a workaround, I can directly define a method with the same signature on <code>AlarmReceiver.Companion</code>:</p>

<pre><code>class AlarmReceiver : WakefulBroadcastReceiver() {

    companion object {
        const val ACTION_NOTIFY = "..."

        // Just call the superclass implementation for now
        fun completeWakefulIntent(intent: Intent): Boolean =
            WakefulBroadcastReceiver.completeWakefulIntent(intent)
    }

    ...
}
</code></pre>

<p>I think this has the same behavior I would have gotten had I relied on the default inherited method from a Java subclass, but I'm wondering if there's a better way to do this. </p>

<p>Is there a way to call an inherited static Java method on a Kotlin subclass?</p>