title: Why can public inline functions call private constructors
body: <p>I have a private constructor for my class and implemented invoke on the companion object for some kind of "generic constructor"</p>
  
  <pre><code>class Test private constructor(className: String) {
      companion object {
          // If I remove the internal it fails 
          internal inline operator fun &lt;reified T&gt; invoke(): Test {
              return Test(T::class.java.name) // why can I even call it? The constructor is private
          }
      }
  }
  </code></pre>
  
  <p>and I can even have a public inline function that calls that generic constructor</p>
  
  <pre><code>public inline fun test() = Test&lt;Any&gt;() // Why can I call it, it is internal
  </code></pre>
  
  <p>shouldn't that mean that every invokation <code>test()</code> expands to <code>Test(Any::class.java.name)</code> even though that constructor is private?</p>
  
  <p>So my questions are:</p>
  
  <ul>
  <li>Why can that <code>internal inline fun</code> call a private constructor? (a public fun couldn't)</li>
  <li>Why can that <code>public inline fun</code> call an internal function?</li>
  <li>And why can I ultimately expose a private constructor in a <code>public inline fun</code>?</li>
  </ul>