Problem with public static/companion property


Hi Kotliners,

when i using below code

  companion object {
    val port = 8081

    public var uploadService = WireMockClassRule(port)

I am getting junit error

org.junit.internal.runners.rules.ValidationError: The @ClassRule ‘uploadService’ must be public.

seems like Junit or any Java code is not able use @ClassRule since it is defined inside companion object block hence not in the public scope.

since @JavaStatic is not supported outside companion objects, I got stuck’d now. please help!



You should specify use-site target for annotation

    val uploadService = ...