Kotlin access protected static nested java class


#1

I come with a question from Stackoverflow, that spiked my interest and I could not answer to my satisfaction.
Suppose A.java:

public class A {
     public void overrideMe(B param){
          //TODO: override me in Kotlin!
    }
    protected static class B {
    }
}

And K.kt

class K: A() {
    override fun overrideMe(param: B) {
        println("Wow!")
    }
}

If K would be a java class there would be no problem, but in Kotlin the compile-error says:

‘public’ function exposes its ‘protected (in A)’ parameter type B

This can be an issue when working with certain Java libraries. (see exmaple in the stackoverflow question).
How is this issue solvable? There must be a better way than to use Java to handle the protected static class.