Search code examples
classkotlininstantiation

Kotlin: Unresolved reference on custom class instance


I have a Kotlin class named HttpsAuthenticator. The file in which that class resides is also by the same name. HttpsAuthenticator has an inner class named XYZ. Here is the code:

public class HttpsAuthenticator
{
    public class XYZ{

    }
}

enter image description here

From another class, when I instantiate each of those two classes, HttpsAuthenticator() fails with the error Unresolved reference. What is the difference. How do I instantiate HttpsAuthenticator? Im absolutely new to Kotlin so I must be missing something basic I believe?


Solution

  • What ended up fixing it was simply adding import HttpsAuthenticator

    Why XYZ was visible before that is beyond my comprehension at the moment. Im sure someone will come up with an explanation to this.