@JvmField no longer inferred in RC EAPs?

After switching to 1.0.0-rc-1017, we now have to add explicit @JvmField in more places than before, e.g.:

class MyJunitTest {
  companion object {
    @ClassRule
    @JvmField
    val tempFolder = TemporaryFolder() 
  }

Is this change intentional? This is becoming quite verbose.

It’s been announced and reasoned in Beta Candidate, please see @JvmField and objects section.

Thanks for the pointer. Sounds like this stopped working a while ago, and I just didn’t notice until now.

It would be handy to have a way to define annotation aliases. This would allow to define a @KotlinRule annotation that would get translated into @Rule and @JvmField at compile time.

In Groovy this feature is called “annotation collectors”:

2 Likes