# Kotlin access protected static nested java class

**URL:** <https://discuss.kotlinlang.org/t/kotlin-access-protected-static-nested-java-class/7062>\
**Category:** Language Design\
**Created:** [March 15, 2018, 6:18pm UTC](https://discuss.kotlinlang.org/t/kotlin-access-protected-static-nested-java-class/7062 "2018-03-15T18:18:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leokraemer](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@leokraemer](https://discuss.kotlinlang.org/u/leokraemer)\
**Post date:** [March 15, 2018, 6:18pm UTC](https://discuss.kotlinlang.org/t/kotlin-access-protected-static-nested-java-class/7062/1 "2018-03-15T18:18:12Z")

</div>

I come with a [question](https://stackoverflow.com/questions/49284094/inheritance-from-java-class-with-a-public-method-accepting-a-protected-class-in/49287402#49287402) 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.
