Problem with public static/companion property

Hi Kotliners,

when i using below code

  companion object {
    val port = 8081

    @ClassRule
    @Rule
    @JvmStatic
    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!

Thanks,
Manish

You should specify use-site target for annotation

    @get:ClassRule
    @JvmStatic
    val uploadService = ...